first commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.mhd;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import com.mhd.common.security.annotation.EnableCustomConfig;
|
||||
import com.mhd.common.security.annotation.EnableRyFeignClients;
|
||||
import com.mhd.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author mhd
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
public class MhdSystemApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(MhdSystemApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.factory.BasicAgreementFactory;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.po.BasicAgreementPO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.service.BasicAgreementDomainService;
|
||||
import com.mhd.basic.interfaces.dto.BasicAgreementDTO;
|
||||
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.domain.po.SysTenantsPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BasicAgreementApplicationService {
|
||||
|
||||
@Resource
|
||||
private BasicAgreementDomainService basicAgreementDomainService;
|
||||
@Resource
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
public List<BasicAgreementEntity> selectList(BasicAgreementDO basicAgreementDO) {
|
||||
//只查询当前组织下的
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
basicAgreementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
return basicAgreementDomainService.selectList(basicAgreementDO);
|
||||
}
|
||||
|
||||
public BasicAgreementPO findAgreement(BasicAgreementDO basicAgreementDO) {
|
||||
return basicAgreementDomainService.findAgreement(basicAgreementDO);
|
||||
}
|
||||
|
||||
public int addAgreement(BasicAgreementDO basicAgreementDO) {
|
||||
BasicAgreementEntity basicAgreementEntity = new BasicAgreementFactory().getAgreementEntity(basicAgreementDO);
|
||||
//查询选中的组织信息
|
||||
if(basicAgreementEntity.getOrganizationId()==null){
|
||||
throw new ServiceException("所属组织机构不能为空");
|
||||
}
|
||||
//判断协议有没有添加过
|
||||
BasicAgreementDO basicAgreementDO1 = new BasicAgreementDO();
|
||||
List<BasicAgreementEntity> basicAgreementEntities = basicAgreementDomainService.selectList(basicAgreementDO1);
|
||||
if (basicAgreementEntities != null && !basicAgreementEntities.isEmpty()) {
|
||||
throw new ServiceException("当前组织协议类型已存在");
|
||||
}
|
||||
|
||||
//获取当前组织
|
||||
AjaxResult organizationInfo = productServiceFeign.getOrganizationInfo(basicAgreementEntity.getOrganizationId());
|
||||
if("200".equals(String.valueOf(organizationInfo.get("code")))){
|
||||
OrganizationPo organizationPo = JSONObject.parseObject(JSONObject.toJSONString(organizationInfo.get("data")), OrganizationPo.class);
|
||||
basicAgreementEntity.setTenantsId(organizationPo.getTenantsId());
|
||||
basicAgreementEntity.setOrganizationId(organizationPo.getOrganizationId());
|
||||
basicAgreementEntity.setOrganizationName(organizationPo.getOrganizationName());
|
||||
basicAgreementEntity.setTopOrganizationId(organizationPo.getOrganizationId());
|
||||
}
|
||||
//填充数据
|
||||
basicAgreementEntity.setBasicAgreementStatus(1);
|
||||
//填充数据字典信息
|
||||
if(StringUtils.isNotBlank(basicAgreementEntity.getBasicAgreementTypeCode())){
|
||||
List<SysDictData> agreementList = sysDictTypeService.selectDictDataByType(DictCode.protocol.getCode());
|
||||
if(null != agreementList && agreementList.size()>0){
|
||||
Optional<SysDictData> sysDictDataVo = agreementList.stream().filter(item -> ObjectUtil.equal(item.getDictValue(),basicAgreementDO.getBasicAgreementTypeCode())).findAny();
|
||||
if(sysDictDataVo.isPresent()){
|
||||
SysDictData sysDictDataVo1 = sysDictDataVo.get();
|
||||
basicAgreementEntity.setBasicAgreementTypeId(String.valueOf(sysDictDataVo1.getDictCode()));
|
||||
basicAgreementEntity.setBasicAgreementTypeCode(sysDictDataVo1.getDictValue());
|
||||
basicAgreementEntity.setBasicAgreementTypeName(sysDictDataVo1.getDictLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
return basicAgreementDomainService.addAgreement(basicAgreementEntity);
|
||||
}
|
||||
|
||||
public int updateAgreement(BasicAgreementDO basicAgreementDO) {
|
||||
//获取登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementDomainService.selectByAgreementId(basicAgreementDO.getBasicAgreementId());
|
||||
if (ObjectUtil.isNull(basicAgreementEntity)) {
|
||||
throw new ServiceException("协议不存在");
|
||||
}
|
||||
basicAgreementEntity.setBasicAgreementContent(basicAgreementDO.getBasicAgreementContent());
|
||||
basicAgreementEntity.setDisplayName(basicAgreementDO.getDisplayName());
|
||||
basicAgreementEntity.setRemark(basicAgreementDO.getRemark());
|
||||
basicAgreementEntity.setUpdateBy(loginUser.getUserid());
|
||||
basicAgreementEntity.setUpdateTime(new Date());
|
||||
basicAgreementEntity.setUpdateByName(loginUser.getUsername());
|
||||
return basicAgreementDomainService.updateAgreement(basicAgreementEntity);
|
||||
}
|
||||
|
||||
public int deleteByIds(List<Long> ids) {
|
||||
return basicAgreementDomainService.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据code获取协议内容
|
||||
* @param basicAgreementDTO
|
||||
* @return
|
||||
*/
|
||||
public BasicAgreementPO getAgreementByCode(BasicAgreementDTO basicAgreementDTO) {
|
||||
if(StringUtils.isBlank(basicAgreementDTO.getAgreementCode())){
|
||||
throw new ServiceException("协议编码不能为空");
|
||||
}
|
||||
|
||||
Long organizationId = null;
|
||||
//根据域名查询当前组织信息,如果当前组织没有配置协议,则使用平台配置的协议
|
||||
if(StringUtils.isNotBlank(basicAgreementDTO.getPath())){
|
||||
AjaxResult topOrganizationIdR = productServiceFeign.getOrganizationByPath(basicAgreementDTO.getPath());
|
||||
if (ObjectUtil.isNull(topOrganizationIdR) || ObjectUtil.isNull(topOrganizationIdR.get("data"))) {
|
||||
throw new ServiceException("组织不存在");
|
||||
}
|
||||
//租户一级组织ID
|
||||
SysTenantsPo sysTenantsPo = JSONObject.parseObject(JSONObject.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
|
||||
organizationId = sysTenantsPo.getOrganizationId();
|
||||
}
|
||||
BasicAgreementDO basicAgreementDO = new BasicAgreementDO();
|
||||
basicAgreementDO.setBasicAgreementTypeCode(basicAgreementDTO.getAgreementCode());
|
||||
if(null == organizationId){
|
||||
organizationId = 1L;
|
||||
}
|
||||
basicAgreementDO.setOrganizationId(organizationId);
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementDomainService.getAgreementByCode(basicAgreementDO);
|
||||
BasicAgreementPO basicAgreementPO = new BasicAgreementPO();
|
||||
if(null != basicAgreementEntity){
|
||||
BeanUtils.copyProperties(basicAgreementEntity,basicAgreementPO);
|
||||
}
|
||||
return basicAgreementPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除协议内容
|
||||
* @param basicAgreementId
|
||||
* @return
|
||||
*/
|
||||
public int deleteById(Long basicAgreementId) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == basicAgreementId){
|
||||
throw new ServiceException("协议id不能为空");
|
||||
}
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementDomainService.selectByAgreementId(basicAgreementId);
|
||||
if(null == basicAgreementEntity){
|
||||
throw new ServiceException("协议不存在");
|
||||
}
|
||||
basicAgreementEntity.setDelFlag(2);
|
||||
basicAgreementEntity.setUpdateBy(loginUser.getUserid());
|
||||
basicAgreementEntity.setUpdateByName(loginUser.getUsername());
|
||||
basicAgreementEntity.setUpdateTime(new Date());
|
||||
return basicAgreementDomainService.updateAgreement(basicAgreementEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询协议内容
|
||||
* @param basicAgreementDO
|
||||
* @return
|
||||
*/
|
||||
public BasicAgreementPO findAgreementById(BasicAgreementDO basicAgreementDO) {
|
||||
if(basicAgreementDO.getBasicAgreementId()==null){
|
||||
throw new ServiceException("协议id不能为空");
|
||||
}
|
||||
BasicAgreementPO basicAgreementPO = new BasicAgreementPO();
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementDomainService.selectByAgreementId(basicAgreementDO.getBasicAgreementId());
|
||||
BeanUtils.copyProperties(basicAgreementEntity,basicAgreementPO);
|
||||
return basicAgreementPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据协议code和租户查询系统协议
|
||||
*/
|
||||
public BasicAgreementEntity findAgreementByCodeAndOrg(BasicAgreementDO basicAgreementDO) {
|
||||
return basicAgreementDomainService.findAgreementByCodeAndOrg(basicAgreementDO);
|
||||
}
|
||||
|
||||
public BasicAgreementPO findAgreementByCode(BasicAgreementDO basicAgreementDO) {
|
||||
if(StringUtils.isBlank(basicAgreementDO.getBasicAgreementTypeCode())){
|
||||
throw new ServiceException("协议编码不能为空");
|
||||
}
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
Long organizationId = userPo.getOrganizationId();
|
||||
basicAgreementDO.setOrganizationId(organizationId);
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementDomainService.getAgreementByCode(basicAgreementDO);
|
||||
BasicAgreementPO basicAgreementPO = new BasicAgreementPO();
|
||||
if (basicAgreementEntity != null){
|
||||
BeanUtils.copyProperties(basicAgreementEntity, basicAgreementPO);
|
||||
}else {
|
||||
basicAgreementDO.setOrganizationId(userPo.getTopOrganizationId());
|
||||
basicAgreementEntity = basicAgreementDomainService.getAgreementByCode(basicAgreementDO);
|
||||
if (basicAgreementEntity != null){
|
||||
BeanUtils.copyProperties(basicAgreementEntity, basicAgreementPO);
|
||||
}
|
||||
}
|
||||
return basicAgreementPO;
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.matter.repository.po.StatisticalMattersPo;
|
||||
import com.mhd.common.core.domain.dto.StatisticalMattersDTO;
|
||||
import com.mhd.common.core.domain.todo.StatisticalMattersDo;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.TransportFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 事项 应用服务层
|
||||
*/
|
||||
@Service
|
||||
public class MatterApplicationService {
|
||||
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private TransportFeign transportFeign;
|
||||
|
||||
/**
|
||||
* 统计代办事项
|
||||
*/
|
||||
public StatisticalMattersPo statisticalMatters() {
|
||||
//后期需要添加推送人管理,这里先临时默认查询当前网点的数据
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
//暂时只查询待审核承运人、待审核托运人、待审核车辆的待办事项
|
||||
|
||||
//待审核车辆
|
||||
Integer vehicleWaitingReview = 0;
|
||||
|
||||
//待审核承运人
|
||||
Integer driverWaitingReview = 0;
|
||||
|
||||
//待审核托运人
|
||||
Integer shipperWaitingReview = 0;
|
||||
|
||||
StatisticalMattersDTO statisticalMattersDTO = new StatisticalMattersDTO();
|
||||
statisticalMattersDTO.setOrganizationId(loginUser.getOrganizationPo().getOrganizationId());
|
||||
|
||||
AjaxResult userResult = userServiceFeign.getDriverAndShipperWaitingReviewSum(statisticalMattersDTO);
|
||||
if ("200".equals(String.valueOf(userResult.get("code")))) {
|
||||
Map<String, Integer> map = (Map<String, Integer>) userResult.get("data");
|
||||
driverWaitingReview = map.get("driverWaitingReview");
|
||||
shipperWaitingReview = map.get("shipperWaitingReview");
|
||||
}
|
||||
|
||||
//待审核车辆
|
||||
AjaxResult result = transportFeign.vehicleCountByMatter(statisticalMattersDTO);
|
||||
if ("200".equals(String.valueOf(result.get("code")))) {
|
||||
vehicleWaitingReview = (Integer) result.get("data");
|
||||
}
|
||||
|
||||
StatisticalMattersPo statisticalMattersPo = new StatisticalMattersPo();
|
||||
statisticalMattersPo.setDriverWaitingReview(driverWaitingReview);
|
||||
statisticalMattersPo.setShipperWaitingReview(shipperWaitingReview);
|
||||
statisticalMattersPo.setVehicleWaitingReview(vehicleWaitingReview);
|
||||
|
||||
return statisticalMattersPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计代办事项
|
||||
*/
|
||||
public StatisticalMattersPo statisticalMatters(Long organizationId) {
|
||||
//后期需要添加推送人管理,这里先临时默认查询当前网点的数据
|
||||
|
||||
//暂时只查询待审核承运人、待审核托运人、待审核车辆的待办事项
|
||||
|
||||
//待审核车辆
|
||||
Integer vehicleWaitingReview = 0;
|
||||
|
||||
//待审核承运人
|
||||
Integer driverWaitingReview = 0;
|
||||
|
||||
//待审核托运人
|
||||
Integer shipperWaitingReview = 0;
|
||||
|
||||
StatisticalMattersDTO statisticalMattersDTO = new StatisticalMattersDTO();
|
||||
statisticalMattersDTO.setOrganizationId(organizationId);
|
||||
|
||||
AjaxResult userResult = userServiceFeign.getDriverAndShipperWaitingReviewSum(statisticalMattersDTO);
|
||||
if ("200".equals(String.valueOf(userResult.get("code")))) {
|
||||
Map<String, Integer> map = (Map<String, Integer>) userResult.get("data");
|
||||
driverWaitingReview = map.get("driverWaitingReview");
|
||||
shipperWaitingReview = map.get("shipperWaitingReview");
|
||||
}
|
||||
|
||||
//待审核车辆
|
||||
AjaxResult result = transportFeign.vehicleCountByMatter(statisticalMattersDTO);
|
||||
if ("200".equals(String.valueOf(result.get("code")))) {
|
||||
vehicleWaitingReview = (Integer) result.get("data");
|
||||
}
|
||||
|
||||
StatisticalMattersPo statisticalMattersPo = new StatisticalMattersPo();
|
||||
statisticalMattersPo.setDriverWaitingReview(driverWaitingReview);
|
||||
statisticalMattersPo.setShipperWaitingReview(shipperWaitingReview);
|
||||
statisticalMattersPo.setVehicleWaitingReview(vehicleWaitingReview);
|
||||
|
||||
return statisticalMattersPo;
|
||||
}
|
||||
}
|
||||
+774
@@ -0,0 +1,774 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.*;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.mhd.basic.interfaces.assember.MessageManageAssember;
|
||||
import com.mhd.basic.interfaces.dto.NoticeAnnouncementDto;
|
||||
import com.mhd.basic.interfaces.dto.NoticeMessageLoggingDto;
|
||||
import com.mhd.basic.domain.common.entity.DataPermission;
|
||||
import com.mhd.basic.domain.messageManage.entity.NoticeAnnouncement;
|
||||
import com.mhd.basic.domain.messageManage.entity.NoticeMessageLogging;
|
||||
import com.mhd.basic.domain.messageManage.entity.NoticeMouldManage;
|
||||
import com.mhd.basic.domain.messageManage.repository.po.NoticeAnnouncementPo;
|
||||
import com.mhd.basic.domain.messageManage.repository.po.NoticeMessageLoggingAppListPo;
|
||||
import com.mhd.basic.domain.messageManage.repository.po.NoticeMessageLoggingPo;
|
||||
import com.mhd.basic.domain.messageManage.repository.po.NoticeMouldManagePo;
|
||||
import com.mhd.basic.domain.messageManage.repository.todo.NoticeAnnouncementDo;
|
||||
import com.mhd.basic.domain.messageManage.repository.todo.NoticeMessageLoggingDo;
|
||||
import com.mhd.basic.domain.messageManage.repository.todo.NoticeMouldManageDo;
|
||||
import com.mhd.basic.domain.messageManage.service.NoticeAnnouncementDomainService;
|
||||
import com.mhd.basic.domain.messageManage.service.NoticeMessageLoggingDomainService;
|
||||
import com.mhd.basic.domain.messageManage.service.NoticeMouldManageDomainService;
|
||||
import com.mhd.basic.infrastructure.feign.SystemServiceFeign;
|
||||
import com.mhd.basic.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.enums.MessageTypeEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.service.jPush.AsyncJPushApplicationService;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.date.DateNowString;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.mhd.common.core.enums.RoleEnum.*;
|
||||
import static com.mhd.common.core.enums.RoleEnum.COMPANY;
|
||||
|
||||
/**
|
||||
* 消息模板配置Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-03-29
|
||||
*/
|
||||
@Service
|
||||
public class MessageManageApplicationService
|
||||
{
|
||||
@Resource
|
||||
private NoticeMouldManageDomainService noticeMouldManageDomainService;
|
||||
@Resource
|
||||
private NoticeMessageLoggingDomainService noticeMessageLoggingDomainService;
|
||||
@Resource
|
||||
private NoticeAnnouncementDomainService noticeAnnouncementDomainService;
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Resource
|
||||
private AsyncJPushApplicationService asyncJPushApplicationService;
|
||||
|
||||
/**
|
||||
* 查询消息模板配置
|
||||
*
|
||||
* @param noticeMouldManageId 消息模板配置主键
|
||||
* @return 消息模板配置
|
||||
*/
|
||||
public NoticeMouldManagePo selectNoticeMouldManageById(Long noticeMouldManageId)
|
||||
{
|
||||
return noticeMouldManageDomainService.selectNoticeMouldManageById(noticeMouldManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消息模板配置列表
|
||||
*
|
||||
* @param noticeMouldManageDo 消息模板配置
|
||||
* @return 消息模板配置
|
||||
*/
|
||||
public List<NoticeMouldManagePo> selectNoticeMouldManageList(NoticeMouldManageDo noticeMouldManageDo)
|
||||
{
|
||||
return noticeMouldManageDomainService.selectNoticeMouldManageList(noticeMouldManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询通知类型模板
|
||||
* @param noticeMouldManageDo
|
||||
* @return
|
||||
*/
|
||||
public List<NoticeMouldManagePo> noticeMouldManageList(NoticeMouldManageDo noticeMouldManageDo,DataPermission dataPermission) {
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
noticeMouldManageDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeMouldManageDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
//首先将配置表中的当前最高组织下所有数据全部查询出来
|
||||
Long topOrganizationId = SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId();
|
||||
noticeMouldManageDo.setOrganizationId(topOrganizationId);
|
||||
List<NoticeMouldManagePo> noticeMouldManagePoList = noticeMouldManageDomainService.selectNoticeMouldManageList(noticeMouldManageDo);
|
||||
List<NoticeMouldManagePo> returnList = new ArrayList<>();
|
||||
List<SysDictDataVo> noticeTypeList = new ArrayList<>();
|
||||
List<SysDictDataVo> noticeRoleList = new ArrayList<>();
|
||||
//查询数据字典通知类型中的配置
|
||||
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.NOTICE_TYPE.getCode());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
noticeTypeList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
//查询数据字典通知角色的配置
|
||||
AjaxResult roleRes = systemServiceFeign.selectListByDictType(DictCode.NOTICE_ROLE.getCode());
|
||||
if("200".equals(String.valueOf(roleRes.get("code")))){
|
||||
noticeRoleList = JSON.parseArray(JSONObject.toJSONString(roleRes.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
//封装通知模板list
|
||||
if(noticeTypeList.size()==0){
|
||||
throw new ServiceException("请先维护通知类型数据字典");
|
||||
}
|
||||
if(noticeRoleList.size()==0){
|
||||
throw new ServiceException("请先维护通知角色数据字典");
|
||||
}
|
||||
//编辑通知类型,和通知角色,封装返回的数据列表,如果查询的数据中有,则赋值返回
|
||||
for (SysDictDataVo typeDictData : noticeTypeList) {
|
||||
for (SysDictDataVo roleDictData : noticeRoleList) {
|
||||
List<NoticeMouldManagePo> noticeMouldManagePos = noticeMouldManagePoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeTypeCode(),typeDictData.getDictValue())
|
||||
&& ObjectUtil.equal(info.getNoticeRoleCode(),roleDictData.getDictValue())).collect(Collectors.toList());
|
||||
//如果查询到数据库中有存储,则直接赋值
|
||||
if(noticeMouldManagePos.size()>0){
|
||||
returnList.add(noticeMouldManagePos.get(0));
|
||||
}else {
|
||||
//没找到,则给一个空的模板
|
||||
NoticeMouldManagePo blank = new NoticeMouldManagePo();
|
||||
//这里前端列表展示需要一个唯一的id,随机生成六位数
|
||||
blank.setNoticeMouldManageId(Long.valueOf(RandomUtil.randomNumbers(6)));
|
||||
blank.setNoticeTypeCode(typeDictData.getDictValue());
|
||||
blank.setNoticeTypeName(typeDictData.getDictLabel());
|
||||
blank.setNoticeRoleCode(roleDictData.getDictValue());
|
||||
blank.setNoticeRoleName(roleDictData.getDictLabel());
|
||||
returnList.add(blank);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知模板配置
|
||||
* @param noticeMouldManage
|
||||
* @return
|
||||
*/
|
||||
public int addNoticeMould(NoticeMouldManage noticeMouldManage) {
|
||||
//获取当前登录人最高组织
|
||||
Long topOrganizationId = SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId();
|
||||
noticeMouldManage.setOrganizationId(topOrganizationId);
|
||||
//填充数据字典
|
||||
// getDictCodeInfo(noticeMouldManage);
|
||||
return noticeMouldManageDomainService.addNoticeMould(noticeMouldManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑通知模板配置
|
||||
*/
|
||||
public int editNoticeMould(NoticeMouldManage noticeMouldManage) {
|
||||
//获取当前登录人最高组织
|
||||
Long topOrganizationId = SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId();
|
||||
noticeMouldManage.setOrganizationId(topOrganizationId);
|
||||
//因为需要使用跨服务调用,这里最好查询出旧的数据做对比是否改变
|
||||
NoticeMouldManagePo noticeMouldManageOld = noticeMouldManageDomainService.selectNoticeMouldManageById(noticeMouldManage.getNoticeMouldManageId());
|
||||
if(null != noticeMouldManageOld){
|
||||
if(!ObjectUtil.equal(noticeMouldManage.getNoticeTypeCode(),noticeMouldManageOld.getNoticeTypeCode())
|
||||
|| !ObjectUtil.equal(noticeMouldManage.getNoticeRoleCode(),noticeMouldManageOld.getNoticeRoleCode())){
|
||||
//修改填充数据字典
|
||||
// getDictCodeInfo(noticeMouldManage);
|
||||
}
|
||||
}
|
||||
return noticeMouldManageDomainService.editNoticeMould(noticeMouldManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充通知模板数据字典
|
||||
* @param noticeMouldManage
|
||||
*/
|
||||
private NoticeMouldManage getDictCodeInfo(NoticeMouldManage noticeMouldManage) {
|
||||
List<SysDictDataVo> noticeTypeList = new ArrayList<>();
|
||||
List<SysDictDataVo> noticeRoleList = new ArrayList<>();
|
||||
//查询数据字典通知类型中的配置
|
||||
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.NOTICE_TYPE.getCode());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
noticeTypeList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
//查询数据字典通知角色的配置
|
||||
AjaxResult roleRes = systemServiceFeign.selectListByDictType(DictCode.NOTICE_ROLE.getCode());
|
||||
if("200".equals(String.valueOf(roleRes.get("code")))){
|
||||
noticeRoleList = JSON.parseArray(JSONObject.toJSONString(roleRes.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
if(noticeTypeList.size()==0){
|
||||
throw new ServiceException("请先维护通知类型数据字典");
|
||||
}
|
||||
if(noticeRoleList.size()==0){
|
||||
throw new ServiceException("请先维护通知角色数据字典");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(noticeMouldManage.getNoticeTypeCode())){
|
||||
Optional<SysDictDataVo> sysDictDataVo = noticeTypeList.stream().filter(info->ObjectUtil.equal(info.getDictValue(),noticeMouldManage.getNoticeTypeCode())).findAny();
|
||||
if(sysDictDataVo.isPresent()){
|
||||
SysDictDataVo sysDictDataVo1 = sysDictDataVo.get();
|
||||
noticeMouldManage.setNoticeTypeName(sysDictDataVo1.getDictLabel());
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(noticeMouldManage.getNoticeRoleCode())){
|
||||
Optional<SysDictDataVo> sysDictDataVo = noticeTypeList.stream().filter(info->ObjectUtil.equal(info.getDictValue(),noticeMouldManage.getNoticeRoleCode())).findAny();
|
||||
if(sysDictDataVo.isPresent()){
|
||||
SysDictDataVo sysDictDataVo1 = sysDictDataVo.get();
|
||||
noticeMouldManage.setNoticeRoleName(sysDictDataVo1.getDictLabel());
|
||||
}
|
||||
}
|
||||
return noticeMouldManage;
|
||||
}
|
||||
|
||||
|
||||
public NoticeMouldManagePo selectMouldInfoByIds(Long noticeMouldManageId) {
|
||||
return noticeMouldManageDomainService.selectMouldInfoByIds(noticeMouldManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息记录分页列表查询
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public List<NoticeMessageLoggingPo> noticeMessageLoggingList(NoticeMessageLoggingDo noticeMessageLoggingDo, DataPermission dataPermission) {
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
noticeMessageLoggingDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeMessageLoggingDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
// noticeMessageLoggingDo.setNoticeQueryType("1");
|
||||
return noticeMessageLoggingDomainService.selectNoticeMessageLoggingList(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息记录统计未读消息
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public Integer noticeMessageLoggingUnreadSum(NoticeMessageLoggingDo noticeMessageLoggingDo, DataPermission dataPermission) {
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
noticeMessageLoggingDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeMessageLoggingDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
// noticeMessageLoggingDo.setNoticeQueryType("1");
|
||||
noticeMessageLoggingDo.setMessageReadStatus(2);
|
||||
List<NoticeMessageLoggingPo> noticeMessageLoggingPos = noticeMessageLoggingDomainService.selectNoticeMessageLoggingList(noticeMessageLoggingDo);
|
||||
return noticeMessageLoggingPos.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消息记录
|
||||
* @param noticeMessageLogging
|
||||
* @return
|
||||
*/
|
||||
public boolean addMessageLogging(NoticeMessageLogging noticeMessageLogging) {
|
||||
if(noticeMessageLogging.getUserId()!=null){
|
||||
AjaxResult<?> ajaxResult = userServiceFeign.getInfo(noticeMessageLogging.getUserId());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
Map<String,Object> map = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), Map.class);
|
||||
UserPo userPo = JSONObject.parseObject(JSONObject.toJSONString(map), UserPo.class);
|
||||
//根据当前用户组织信息获取到网点信息
|
||||
if(null != userPo){
|
||||
noticeMessageLogging.setUserAccount(userPo.getUserAccount());
|
||||
noticeMessageLogging.setUserName(userPo.getUserName());
|
||||
noticeMessageLogging.setUserPhone(userPo.getUserPhone());
|
||||
noticeMessageLogging.setOrganizationId(userPo.getOrganizationId());
|
||||
noticeMessageLogging.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
}
|
||||
noticeMessageLogging.setMessageReceivingTime(new Date());
|
||||
return noticeMessageLoggingDomainService.addMessageLogging(noticeMessageLogging);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量已读/全部已读
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public boolean operateRead(NoticeMessageLoggingDo noticeMessageLoggingDo,DataPermission dataPermission) {
|
||||
if(noticeMessageLoggingDo.getOperateType()==null || (noticeMessageLoggingDo.getOperateType()!=1 && noticeMessageLoggingDo.getOperateType()!=2)){
|
||||
throw new ServiceException("操作类型未找到");
|
||||
}
|
||||
//批量已读
|
||||
if(noticeMessageLoggingDo.getOperateType()==1){
|
||||
if (ArrayUtil.isEmpty(noticeMessageLoggingDo.getNoticeMessageLoggingIds())) {
|
||||
throw new ServiceException("操作id不能为空");
|
||||
}
|
||||
return noticeMessageLoggingDomainService.batchRead(noticeMessageLoggingDo);
|
||||
} else {
|
||||
//全部已读
|
||||
if(dataPermission != null){
|
||||
if (CollUtil.isNotEmpty(dataPermission.getOrganizationIdList())) {
|
||||
noticeMessageLoggingDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeMessageLoggingDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
return noticeMessageLoggingDomainService.allRead(noticeMessageLoggingDo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public boolean messageBatchDelete(NoticeMessageLoggingDo noticeMessageLoggingDo) {
|
||||
return noticeMessageLoggingDomainService.messageBatchDelete(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前登录用户的未读信息数量
|
||||
* @param noticeMessageLoggingDo
|
||||
* @param dataPermission
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getUnreadInfo(NoticeMessageLoggingDo noticeMessageLoggingDo, DataPermission dataPermission) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("system","0");
|
||||
res.put("transport","0");
|
||||
res.put("finance","0");
|
||||
res.put("sms","0");
|
||||
res.put("event","0");
|
||||
res.put("allCount","0");
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
noticeMessageLoggingDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeMessageLoggingDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
noticeMessageLoggingDo.setMessageReadStatus(2);
|
||||
noticeMessageLoggingDo.setNoticeQueryType("1");
|
||||
List<NoticeMessageLoggingPo> noticeMessageLoggingPoList = noticeMessageLoggingDomainService.selectNoticeMessageLoggingList(noticeMessageLoggingDo);
|
||||
//系统消息
|
||||
long system = noticeMessageLoggingPoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeMessageType(), MessageTypeEnum.system_notifications.getCode()) && info.getMessageReadStatus() == 2).count();
|
||||
//物流消息
|
||||
long transport = noticeMessageLoggingPoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeMessageType(), MessageTypeEnum.logistics_assistant.getCode()) && info.getMessageReadStatus() == 2).count();
|
||||
//财务消息
|
||||
long finance = noticeMessageLoggingPoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeMessageType(), MessageTypeEnum.service_notification.getCode()) && info.getMessageReadStatus() == 2).count();
|
||||
//验证码
|
||||
long sms = noticeMessageLoggingPoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeMessageType(), MessageTypeEnum.code_notifications.getCode()) && info.getMessageReadStatus() == 2).count();
|
||||
//活动通知
|
||||
long event = noticeMessageLoggingPoList.stream().filter(info -> ObjectUtil.equal(info.getNoticeMessageType(), MessageTypeEnum.event_notification.getCode()) && info.getMessageReadStatus() == 2).count();
|
||||
res.put("system",String.valueOf(system));
|
||||
res.put("transport",String.valueOf(transport));
|
||||
res.put("finance",String.valueOf(finance));
|
||||
res.put("sms",String.valueOf(sms));
|
||||
res.put("event",String.valueOf(event));
|
||||
res.put("allCount",String.valueOf(noticeMessageLoggingPoList.size()));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知公告分页列表查询
|
||||
* @param noticeAnnouncementDo
|
||||
* @param dataPermission
|
||||
* @return
|
||||
*/
|
||||
public List<NoticeAnnouncementPo> noticeAnnouncementList(NoticeAnnouncementDo noticeAnnouncementDo, DataPermission dataPermission) {
|
||||
if(dataPermission != null){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
noticeAnnouncementDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
noticeAnnouncementDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
return noticeAnnouncementDomainService.selectNoticeAnnouncementList(noticeAnnouncementDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
* @param noticeAnnouncement
|
||||
* @return
|
||||
*/
|
||||
public boolean addNoticeAnnouncement(NoticeAnnouncement noticeAnnouncement) {
|
||||
Long topOrganizationId = SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId();
|
||||
Long organizationId = SecurityUtils.getLoginUser().getUserPo().getOrganizationId();
|
||||
noticeAnnouncement.setOrganizationId(organizationId);
|
||||
noticeAnnouncement.setTopOrganizationId(topOrganizationId);
|
||||
return noticeAnnouncementDomainService.addNoticeAnnouncement(noticeAnnouncement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑通知公告
|
||||
* @param noticeAnnouncement
|
||||
* @return
|
||||
*/
|
||||
public boolean editNoticeAnnouncement(NoticeAnnouncement noticeAnnouncement) {
|
||||
return noticeAnnouncementDomainService.editNoticeAnnouncement(noticeAnnouncement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询通知公告详情
|
||||
* @param noticeAnnouncementId
|
||||
* @return
|
||||
*/
|
||||
public NoticeAnnouncementPo getNoticeAnnouncementInfo(Long noticeAnnouncementId) {
|
||||
return noticeAnnouncementDomainService.selectNoticeAnnouncementById(noticeAnnouncementId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param noticeAnnouncementDo
|
||||
* @return
|
||||
*/
|
||||
public boolean announcementDelete(NoticeAnnouncementDo noticeAnnouncementDo) {
|
||||
return noticeAnnouncementDomainService.announcementDelete(noticeAnnouncementDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP获取当前用户消息通知
|
||||
* @return
|
||||
*/
|
||||
public List<NoticeMessageLoggingPo> getAppUserNotice(NoticeMessageLoggingDo noticeMessageLoggingDo) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
}
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
return noticeMessageLoggingDomainService.getAppUserNotice(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP消息中心列表查询
|
||||
* @return
|
||||
*/
|
||||
public NoticeMessageLoggingAppListPo getAppNoticeList() {
|
||||
NoticeMessageLoggingAppListPo result = new NoticeMessageLoggingAppListPo();
|
||||
NoticeMessageLoggingDo noticeMessageLoggingDo = new NoticeMessageLoggingDo();
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
}
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
//获取每种类型的最新一条
|
||||
List<NoticeMessageLoggingPo> noticeMessageLoggingPoList = noticeMessageLoggingDomainService.getAppNoticeList(noticeMessageLoggingDo);
|
||||
long serviceNoticeCount = 0L;
|
||||
long actionNoticeCount = 0L;
|
||||
long logisticsNoticeCount = 0L;
|
||||
long systemNoticeCount = 0L;
|
||||
//查询用户所有未读消息
|
||||
List<NoticeMessageLoggingPo> messageLoggingPoList = noticeMessageLoggingDomainService.getAppUserNoticeByType(noticeMessageLoggingDo);
|
||||
messageLoggingPoList = messageLoggingPoList.stream().filter(item -> item.getMessageReadStatus()==2).collect(Collectors.toList());
|
||||
if(messageLoggingPoList.size()>0){
|
||||
serviceNoticeCount = messageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.service_notification.getCode())).count();
|
||||
actionNoticeCount = messageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.event_notification.getCode())).count();
|
||||
logisticsNoticeCount = messageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.logistics_assistant.getCode())).count();
|
||||
systemNoticeCount = messageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.system_notifications.getCode())).count();
|
||||
}
|
||||
//服务通知
|
||||
NoticeMessageLoggingAppListPo.CommonNotice serviceNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
NoticeMessageLoggingPo noticeMessageLoggingPo = noticeMessageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.service_notification.getCode())).findAny().orElse(null);
|
||||
serviceNotice.setUnreadNum(String.valueOf(serviceNoticeCount));
|
||||
if(null != noticeMessageLoggingPo){
|
||||
serviceNotice.setNoticeMessageContent(noticeMessageLoggingPo.getNoticeMessageContent());
|
||||
String time = DateNowString.getDateNowString(new Date(),noticeMessageLoggingPo.getMessageReceivingTime());
|
||||
serviceNotice.setMessageReceivingTime(time);
|
||||
}
|
||||
//活动通知
|
||||
NoticeMessageLoggingAppListPo.CommonNotice activityNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
activityNotice.setUnreadNum(String.valueOf(actionNoticeCount));
|
||||
NoticeMessageLoggingPo activityNoticeLogging = noticeMessageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.event_notification.getCode())).findAny().orElse(null);
|
||||
if(null != activityNoticeLogging){
|
||||
activityNotice.setNoticeMessageContent(activityNoticeLogging.getNoticeMessageContent());
|
||||
String time = DateNowString.getDateNowString(new Date(),activityNoticeLogging.getMessageReceivingTime());
|
||||
activityNotice.setMessageReceivingTime(time);
|
||||
}
|
||||
//物流助手
|
||||
NoticeMessageLoggingAppListPo.CommonNotice logisticsNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
logisticsNotice.setUnreadNum(String.valueOf(logisticsNoticeCount));
|
||||
NoticeMessageLoggingPo logisticsNoticeLogging = noticeMessageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.logistics_assistant.getCode())).findAny().orElse(null);
|
||||
if(null != logisticsNoticeLogging){
|
||||
logisticsNotice.setNoticeMessageContent(logisticsNoticeLogging.getNoticeMessageContent());
|
||||
String time = DateNowString.getDateNowString(new Date(),logisticsNoticeLogging.getMessageReceivingTime());
|
||||
logisticsNotice.setMessageReceivingTime(time);
|
||||
}
|
||||
//系统消息
|
||||
NoticeMessageLoggingAppListPo.CommonNotice systemNotice = new NoticeMessageLoggingAppListPo.CommonNotice();
|
||||
systemNotice.setUnreadNum(String.valueOf(systemNoticeCount));
|
||||
NoticeMessageLoggingPo systemNoticeLogging = noticeMessageLoggingPoList.stream().filter(item -> ObjectUtil.equal(item.getNoticeMessageType(), MessageTypeEnum.system_notifications.getCode())).findAny().orElse(null);
|
||||
if(null != systemNoticeLogging){
|
||||
systemNotice.setNoticeMessageContent(systemNoticeLogging.getNoticeMessageContent());
|
||||
String time = DateNowString.getDateNowString(new Date(),systemNoticeLogging.getMessageReceivingTime());
|
||||
systemNotice.setMessageReceivingTime(time);
|
||||
}
|
||||
result.setServiceNotice(serviceNotice);
|
||||
result.setActivityNotice(activityNotice);
|
||||
result.setLogisticsNotice(logisticsNotice);
|
||||
result.setSystemNotice(systemNotice);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* APP根据类型获取消息通知
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public List<NoticeMessageLoggingPo> getAppUserNoticeByType(NoticeMessageLoggingDo noticeMessageLoggingDo) {
|
||||
if(noticeMessageLoggingDo.getNoticeMessageType()==null){
|
||||
throw new ServiceException("消息类型不能为空");
|
||||
}
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
}
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
return noticeMessageLoggingDomainService.getAppUserNoticeByType(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除未读消息
|
||||
* @param noticeMessageLoggingDo
|
||||
* @return
|
||||
*/
|
||||
public void clearUnread(NoticeMessageLoggingDo noticeMessageLoggingDo) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
}
|
||||
LambdaUpdateWrapper<NoticeMessageLogging> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(NoticeMessageLogging::getMessageReadStatus,1);
|
||||
updateWrapper.set(NoticeMessageLogging::getMessageReadTime,new Date());
|
||||
updateWrapper.set(NoticeMessageLogging::getUpdateBy,loginUser.getUserid());
|
||||
updateWrapper.set(NoticeMessageLogging::getUpdateTime,new Date());
|
||||
updateWrapper.set(NoticeMessageLogging::getUpdateByName,loginUser.getUsername());
|
||||
|
||||
updateWrapper.eq(NoticeMessageLogging::getUserId,loginUser.getUserid());
|
||||
updateWrapper.eq(NoticeMessageLogging::getMessageReadStatus,2);
|
||||
updateWrapper.eq(NoticeMessageLogging::getDelFlag,1);
|
||||
if(noticeMessageLoggingDo.getNoticeMessageLoggingId() != null){
|
||||
updateWrapper.eq(NoticeMessageLogging::getNoticeMessageLoggingId,noticeMessageLoggingDo.getNoticeMessageLoggingId());
|
||||
}else{
|
||||
if(noticeMessageLoggingDo.getNoticeMessageType() != null){
|
||||
updateWrapper.eq(NoticeMessageLogging::getNoticeMessageType,noticeMessageLoggingDo.getNoticeMessageType());
|
||||
}
|
||||
}
|
||||
noticeMessageLoggingDomainService.updateByLambda(updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入消息记录
|
||||
* @param noticeMessageLoggingDto
|
||||
* @return
|
||||
*/
|
||||
public boolean addMessageLoggingList(NoticeMessageLoggingDto noticeMessageLoggingDto) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
List<NoticeMessageLogging> noticeMessageLoggingList = new ArrayList<>();
|
||||
List<NoticeMessageLoggingDto> messageLoggingDtoList = noticeMessageLoggingDto.getNoticeList();
|
||||
if(messageLoggingDtoList==null || messageLoggingDtoList.size()==0){
|
||||
throw new ServiceException("插入消息实体不能为空");
|
||||
}
|
||||
for (NoticeMessageLoggingDto messageLoggingDto : messageLoggingDtoList) {
|
||||
NoticeMessageLogging noticeMessageLogging = new MessageManageAssember().toNoticeMessageDo(messageLoggingDto);
|
||||
if(messageLoggingDto.getUserId()==null){
|
||||
noticeMessageLogging.setUserId(loginUser.getUserid());
|
||||
}
|
||||
AjaxResult<?> ajaxResult = userServiceFeign.getInfo(noticeMessageLogging.getUserId());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
Map<String,Object> map = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), Map.class);
|
||||
UserPo userPo = JSONObject.parseObject(JSONObject.toJSONString(map), UserPo.class);
|
||||
//根据当前用户组织信息获取到网点信息
|
||||
if(null != userPo){
|
||||
noticeMessageLogging.setUserAccount(userPo.getUserAccount());
|
||||
noticeMessageLogging.setUserName(userPo.getUserName());
|
||||
noticeMessageLogging.setUserPhone(userPo.getUserPhone());
|
||||
noticeMessageLogging.setOrganizationId(userPo.getOrganizationId());
|
||||
noticeMessageLogging.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
noticeMessageLogging.setMessageReceivingTime(DateUtil.date());
|
||||
}
|
||||
}
|
||||
noticeMessageLoggingList.add(noticeMessageLogging);
|
||||
}
|
||||
return noticeMessageLoggingDomainService.addMessageLoggingList(noticeMessageLoggingList);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP获取消息未读数量
|
||||
* @return
|
||||
*/
|
||||
public int getAppNoticeListNum() {
|
||||
int num = 0;
|
||||
NoticeMessageLoggingAppListPo noticeMessageLoggingAppListPo = getAppNoticeList();
|
||||
if(null != noticeMessageLoggingAppListPo){
|
||||
NoticeMessageLoggingAppListPo.CommonNotice one = noticeMessageLoggingAppListPo.getActivityNotice();
|
||||
NoticeMessageLoggingAppListPo.CommonNotice two = noticeMessageLoggingAppListPo.getLogisticsNotice();
|
||||
NoticeMessageLoggingAppListPo.CommonNotice three = noticeMessageLoggingAppListPo.getServiceNotice();
|
||||
NoticeMessageLoggingAppListPo.CommonNotice four = noticeMessageLoggingAppListPo.getSystemNotice();
|
||||
num = Integer.parseInt(one.getUnreadNum()) + Integer.parseInt(two.getUnreadNum()) + Integer.parseInt(three.getUnreadNum()) + Integer.parseInt(four.getUnreadNum());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pc 回复消息
|
||||
*
|
||||
* @param noticeMessageLoggingDto
|
||||
* @return
|
||||
*/
|
||||
public Boolean replyModal(NoticeMessageLoggingDto noticeMessageLoggingDto) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
if (ObjectUtil.isNull(noticeMessageLoggingDto.getNoticeMessageLoggingId())) {
|
||||
throw new ServiceException("消息记录ID不能为空");
|
||||
}
|
||||
|
||||
NoticeMessageLoggingPo noticeMessageLoggingPo = noticeMessageLoggingDomainService.selectNoticeMessageLoggingById(noticeMessageLoggingDto.getNoticeMessageLoggingId());
|
||||
if (ObjectUtil.isNull(noticeMessageLoggingPo)) {
|
||||
throw new ServiceException("消息记录不存在");
|
||||
}
|
||||
|
||||
NoticeMessageLogging noticeMessageLogging = new NoticeMessageLogging();
|
||||
|
||||
noticeMessageLogging.setNoticeMessageLoggingId(noticeMessageLoggingDto.getNoticeMessageLoggingId());
|
||||
noticeMessageLogging.setReplyContent(noticeMessageLoggingDto.getReplyContent());
|
||||
noticeMessageLogging.setReplyBy(loginUser.getUserid().toString());
|
||||
noticeMessageLogging.setReplyByName(loginUser.getUsername());
|
||||
noticeMessageLogging.setReplyTime(DateUtil.date());
|
||||
noticeMessageLogging.setUpdateBy(loginUser.getUserid());
|
||||
noticeMessageLogging.setUpdateByName(loginUser.getUsername());
|
||||
noticeMessageLogging.setUpdateTime(DateUtil.date());
|
||||
noticeMessageLogging.setMessageReadStatus(3);
|
||||
|
||||
boolean b = noticeMessageLoggingDomainService.updateById(noticeMessageLogging);
|
||||
|
||||
if (ObjectUtil.isNotNull(noticeMessageLoggingPo.getUserId())) {
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlia("投诉意见回复", noticeMessageLoggingDto.getReplyContent(), noticeMessageLoggingPo.getUserId().toString(), 0);
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
public boolean noticeAnnouncementInfoPush(NoticeAnnouncementDto noticeAnnouncementDto) {
|
||||
Long id = noticeAnnouncementDto.getNoticeAnnouncementId();
|
||||
|
||||
String type = noticeAnnouncementDto.getPushType();
|
||||
|
||||
if (ObjUtil.isNull(id) || StrUtil.isEmpty(type)) {
|
||||
throw new ServiceException("缺少必要参数");
|
||||
}
|
||||
|
||||
List<String> roles = new ArrayList<>();
|
||||
Integer userType = null;
|
||||
//通知角色类型 1-全部 2-承运人 3-托运人
|
||||
switch (type) {
|
||||
case "1":
|
||||
roles = Arrays.asList(SHIPPER.getCode(), COMPANY.getCode(), DRIVER.getCode(), CARRIER.getCode(), CAPTAIN.getCode());
|
||||
break;
|
||||
case "2":
|
||||
userType = 0;
|
||||
roles = Arrays.asList(DRIVER.getCode(), CARRIER.getCode(), CAPTAIN.getCode());
|
||||
break;
|
||||
case "3":
|
||||
userType = 1;
|
||||
roles = Arrays.asList(SHIPPER.getCode(), COMPANY.getCode());
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("推送类型错误");
|
||||
}
|
||||
|
||||
NoticeAnnouncementPo noticeAnnouncementPo = noticeAnnouncementDomainService.selectNoticeAnnouncementById(id);
|
||||
if (ObjUtil.isNull(noticeAnnouncementPo)) {
|
||||
throw new ServiceException("公告不存在");
|
||||
}
|
||||
|
||||
String title = noticeAnnouncementPo.getNoticeAnnouncementTitle();
|
||||
|
||||
String content = noticeAnnouncementPo.getNoticeAnnouncementContent();
|
||||
|
||||
//获取相应用户ID
|
||||
AjaxResult result = userServiceFeign.getUserIdByRoleCode(roles);
|
||||
if (!"200".equals(String.valueOf(result.get("code")))) {
|
||||
throw new ServiceException("获取推送用户失败");
|
||||
}
|
||||
List<String> list = JSONUtil.toList(JSONObject.toJSONString(result.get("data")), String.class);
|
||||
|
||||
if (userType != null){
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlias(title, content, list, userType);
|
||||
}else {
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlias(title, content, list, 0);
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlias(title, content, list, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<NoticeAnnouncementPo> announcementHomeList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
NoticeAnnouncementDo noticeAnnouncementDo = new NoticeAnnouncementDo();
|
||||
List<Long> organizationIdList = new ArrayList<>();
|
||||
organizationIdList.add(loginUser.getUserPo().getOrganizationId());
|
||||
noticeAnnouncementDo.setOrganizationIdList(organizationIdList);
|
||||
return noticeAnnouncementDomainService.selectNoticeAnnouncementList(noticeAnnouncementDo);
|
||||
}
|
||||
|
||||
public List<NoticeMessageLoggingPo> noticeHomeList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
NoticeMessageLoggingDo noticeMessageLoggingDo = new NoticeMessageLoggingDo();
|
||||
noticeMessageLoggingDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
noticeMessageLoggingDo.setNoticeMessageType("-1");
|
||||
return noticeMessageLoggingDomainService.selectNoticeMessageLoggingList(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
public List<NoticeMessageLoggingPo> taskHomeList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
NoticeMessageLoggingDo noticeMessageLoggingDo = new NoticeMessageLoggingDo();
|
||||
noticeMessageLoggingDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
noticeMessageLoggingDo.setUserId(loginUser.getUserid());
|
||||
noticeMessageLoggingDo.setNoticeMessageType("7");
|
||||
return noticeMessageLoggingDomainService.selectNoticeMessageLoggingList(noticeMessageLoggingDo);
|
||||
}
|
||||
|
||||
public Map<String, String> noticeAnnouncementHomeListCount() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<NoticeMessageLoggingPo> noticeMessageLoggingPoList =noticeHomeList();
|
||||
noticeMessageLoggingPoList = noticeMessageLoggingPoList.stream().filter(item -> item.getMessageReadStatus()==2).collect(Collectors.toList());
|
||||
String notice = String.valueOf(noticeMessageLoggingPoList.size());
|
||||
String announcement = String.valueOf(announcementHomeList().size());
|
||||
List<NoticeMessageLoggingPo> noticeMessageLoggingPoListTwo =taskHomeList();
|
||||
noticeMessageLoggingPoListTwo = noticeMessageLoggingPoListTwo.stream().filter(item -> item.getMessageReadStatus()==2).collect(Collectors.toList());
|
||||
String task = String.valueOf(noticeMessageLoggingPoListTwo.size());
|
||||
map.put("notice",notice);
|
||||
map.put("announcement",announcement);
|
||||
map.put("task",task);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.common.entity.DataPermission;
|
||||
import com.mhd.basic.domain.sysAppVersionManage.entity.SysAppVersionManage;
|
||||
import com.mhd.basic.domain.sysAppVersionManage.repository.po.SysAppVersionManagePo;
|
||||
import com.mhd.basic.domain.sysAppVersionManage.repository.po.SysAppVersionUpdatePo;
|
||||
import com.mhd.basic.domain.sysAppVersionManage.repository.todo.SysAppVersionManageDo;
|
||||
import com.mhd.basic.domain.sysAppVersionManage.service.SysAppVersionManageDomainService;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP版本管理Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-03-22
|
||||
*/
|
||||
@Service
|
||||
public class SysAppVersionManageApplicationService
|
||||
{
|
||||
@Autowired
|
||||
private SysAppVersionManageDomainService sysAppVersionManageDomainService;
|
||||
@Autowired
|
||||
private ISysDictDataService sysDictDataService;
|
||||
|
||||
/**
|
||||
* 查询APP版本管理
|
||||
*
|
||||
* @param sysAppVersionManageId APP版本管理主键
|
||||
* @return APP版本管理
|
||||
*/
|
||||
public SysAppVersionManagePo selectSysAppVersionManageBySysAppVersionManageId(Long sysAppVersionManageId)
|
||||
{
|
||||
return sysAppVersionManageDomainService.selectSysAppVersionManageBySysAppVersionManageId(sysAppVersionManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP版本管理列表
|
||||
*
|
||||
* @param sysAppVersionManageDo APP版本管理
|
||||
* @return APP版本管理
|
||||
*/
|
||||
public List<SysAppVersionManagePo> selectSysAppVersionManageList(SysAppVersionManageDo sysAppVersionManageDo)
|
||||
{
|
||||
return sysAppVersionManageDomainService.selectSysAppVersionManageList(sysAppVersionManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP版本管理
|
||||
* @param sysAppVersionManage
|
||||
* @return
|
||||
*/
|
||||
public boolean addAppVersionManage(SysAppVersionManage sysAppVersionManage) {
|
||||
//获取当前登录人,获取当前登录人的租户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
sysAppVersionManage.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
sysAppVersionManage.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
sysAppVersionManage.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
return sysAppVersionManageDomainService.addAppVersionManage(sysAppVersionManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑APP版本管理
|
||||
* @param sysAppVersionManage
|
||||
* @return
|
||||
*/
|
||||
public boolean updateAppVersionManage(SysAppVersionManage sysAppVersionManage) {
|
||||
return sysAppVersionManageDomainService.updateAppVersionManage(sysAppVersionManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询版本管理详情
|
||||
* @param sysAppVersionManageId
|
||||
* @return
|
||||
*/
|
||||
public SysAppVersionManagePo getAppVersionManage(Long sysAppVersionManageId) {
|
||||
return sysAppVersionManageDomainService.selectSysAppVersionManageBySysAppVersionManageId(sysAppVersionManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param sysAppVersionManageDo
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteAppVersionManage(SysAppVersionManageDo sysAppVersionManageDo) {
|
||||
return sysAppVersionManageDomainService.deleteAppVersionManage(sysAppVersionManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本管理分页列表查询
|
||||
* @param sysAppVersionManageDo
|
||||
* @param dataPermission
|
||||
* @return
|
||||
*/
|
||||
public List<SysAppVersionManagePo> selectAppVersionManageList(SysAppVersionManageDo sysAppVersionManageDo, DataPermission dataPermission) {
|
||||
return sysAppVersionManageDomainService.selectSysAppVersionManageList(sysAppVersionManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP升级记录
|
||||
* @param sysAppVersionManageDo
|
||||
* @param dataPermission
|
||||
* @return
|
||||
*/
|
||||
public List<SysAppVersionManagePo> selectAppVersionHistoryList(SysAppVersionManageDo sysAppVersionManageDo, DataPermission dataPermission) {
|
||||
return sysAppVersionManageDomainService.selectAppVersionHistoryList(sysAppVersionManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据APP包名查询APP版本更新信息
|
||||
* @param sysAppVersionManageDo
|
||||
* @return
|
||||
*/
|
||||
public SysAppVersionUpdatePo getAppVersionManageInfo(SysAppVersionManageDo sysAppVersionManageDo) {
|
||||
if(StringUtils.isEmpty(sysAppVersionManageDo.getAppMark())){
|
||||
throw new ServiceException("APP包名不能为空");
|
||||
}
|
||||
return sysAppVersionManageDomainService.getAppVersionManageInfo(sysAppVersionManageDo.getAppMark());
|
||||
}
|
||||
}
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.basic.interfaces.dto.SysMultistageDictDto;
|
||||
import com.mhd.basic.domain.common.entity.DataPermission;
|
||||
import com.mhd.basic.domain.sysMultistageDict.entity.SysMultistageDict;
|
||||
import com.mhd.basic.domain.sysMultistageDict.repository.po.SysMultistageDictPo;
|
||||
import com.mhd.basic.domain.sysMultistageDict.repository.todo.SysMultistageDictDo;
|
||||
import com.mhd.basic.domain.sysMultistageDict.service.SysMultistageDictDomainService;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 多级分类字典Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-03-21
|
||||
*/
|
||||
@Service
|
||||
public class SysMultistageDictApplicationService
|
||||
{
|
||||
@Autowired
|
||||
private SysMultistageDictDomainService sysMultistageDictDomainService;
|
||||
@Resource
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 查询多级分类字典
|
||||
*
|
||||
* @param sysMultistageDictId 多级分类字典主键
|
||||
* @return 多级分类字典
|
||||
*/
|
||||
public SysMultistageDictPo selectSysMultistageDictById(Long sysMultistageDictId)
|
||||
{
|
||||
return sysMultistageDictDomainService.selectSysMultistageDictById(sysMultistageDictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多级分类字典列表
|
||||
*
|
||||
* @param sysMultistageDictDo 多级分类字典
|
||||
* @return 多级分类字典
|
||||
*/
|
||||
public List<SysMultistageDictPo> selectSysMultistageDictList(SysMultistageDictDo sysMultistageDictDo)
|
||||
{
|
||||
return sysMultistageDictDomainService.selectSysMultistageDictList(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多级分类字典
|
||||
* @param sysMultistageDictDo
|
||||
* @return
|
||||
*/
|
||||
public List<SysMultistageDictPo> selectMultistageDictList(SysMultistageDictDo sysMultistageDictDo, DataPermission dataPermission) {
|
||||
// if(ObjectUtil.isNotEmpty(dataPermission)){
|
||||
// if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
// sysMultistageDictDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
// }
|
||||
// if(dataPermission.getCreateBy() != null){
|
||||
// sysMultistageDictDo.setCreateBy(dataPermission.getCreateBy());
|
||||
// }
|
||||
// }
|
||||
return sysMultistageDictDomainService.selectSysMultistageDictList(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多级分类字典
|
||||
* @param sysMultistageDictDo
|
||||
* @return
|
||||
*/
|
||||
public List<SysMultistageDictPo> getMultistageDictList(SysMultistageDictDo sysMultistageDictDo) {
|
||||
return sysMultistageDictDomainService.selectSysMultistageDictList(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多级分类字典(app)
|
||||
* @param sysMultistageDictDo
|
||||
* @return
|
||||
*/
|
||||
public List<SysMultistageDictPo> selectAppMultistageDictList(SysMultistageDictDo sysMultistageDictDo) {
|
||||
sysMultistageDictDo.setTopParentDictCode("goods_name");
|
||||
if(StringUtils.isNotEmpty(sysMultistageDictDo.getMultistageDictName())){
|
||||
sysMultistageDictDo.setNotParentCode("goods_name");
|
||||
}
|
||||
return sysMultistageDictDomainService.selectSysMultistageDictList(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增多级分类字典
|
||||
* @param sysMultistageDict
|
||||
* @return
|
||||
*/
|
||||
public boolean addMultistageDict(SysMultistageDict sysMultistageDict) {
|
||||
return sysMultistageDictDomainService.addMultistageDict(sysMultistageDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增多级分类字典 - 开放接口
|
||||
*/
|
||||
public boolean addMultistageDictByOpen(SysMultistageDict sysMultistageDict) {
|
||||
return sysMultistageDictDomainService.addMultistageDictByOpen(sysMultistageDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑多级分类字典
|
||||
* @param sysMultistageDict
|
||||
* @return
|
||||
*/
|
||||
public boolean updateMultistageDict(SysMultistageDict sysMultistageDict) {
|
||||
return sysMultistageDictDomainService.updateMultistageDict(sysMultistageDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询多级字典信息
|
||||
* @param sysMultistageDictId
|
||||
* @return
|
||||
*/
|
||||
public SysMultistageDictPo getMultistageDictInfo(Long sysMultistageDictId) {
|
||||
return sysMultistageDictDomainService.getMultistageDictInfo(sysMultistageDictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除字典数据
|
||||
* @param sysMultistageDictDo
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteMultistageDictById(SysMultistageDictDo sysMultistageDictDo) {
|
||||
return sysMultistageDictDomainService.deleteMultistageDictById(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典启用停用
|
||||
* @param sysMultistageDictDo
|
||||
* @return
|
||||
*/
|
||||
public boolean changeDictStatus(SysMultistageDictDo sysMultistageDictDo) {
|
||||
return sysMultistageDictDomainService.changeDictStatus(sysMultistageDictDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多级分类字典,树状 (只能从顶级开始)
|
||||
* @param sysMultistageDictDo
|
||||
* @param dataPermission
|
||||
* @return
|
||||
*/
|
||||
public List<SysMultistageDictPo> selectMultistageDictTreeList(SysMultistageDictDo sysMultistageDictDo, DataPermission dataPermission) {
|
||||
//查询出所有数据
|
||||
if(ObjectUtil.isNotEmpty(dataPermission)){
|
||||
if(dataPermission.getOrganizationIdList() != null && dataPermission.getOrganizationIdList().size() > 0){
|
||||
sysMultistageDictDo.setOrganizationIdList(dataPermission.getOrganizationIdList());
|
||||
}
|
||||
if(dataPermission.getCreateBy() != null){
|
||||
sysMultistageDictDo.setCreateBy(dataPermission.getCreateBy());
|
||||
}
|
||||
}
|
||||
List<SysMultistageDictPo> treeList = new ArrayList<>();
|
||||
List<SysMultistageDictPo> sysMultistageDictPoList = sysMultistageDictDomainService.selectSysMultistageDictList(sysMultistageDictDo);
|
||||
if (CollectionUtil.isNotEmpty(sysMultistageDictPoList)){
|
||||
Map<String, List<SysMultistageDictPo>> collect = sysMultistageDictPoList.stream().collect(Collectors.groupingBy(SysMultistageDictPo::getParentDictCode));
|
||||
treeList = recursionMethod(treeList,collect);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归方法转换成树形结构
|
||||
* @param treeList
|
||||
* @return
|
||||
*/
|
||||
public List<SysMultistageDictPo> recursionMethod(List<SysMultistageDictPo> treeList, Map<String, List<SysMultistageDictPo>> collect) {
|
||||
if (treeList != null && !treeList.isEmpty()){
|
||||
for (SysMultistageDictPo sysMultistageDictPo : treeList) {
|
||||
String parentDictList = sysMultistageDictPo.getParentDictList();
|
||||
if (StringUtils.isNotBlank(parentDictList)){
|
||||
sysMultistageDictPo.setGrade(parentDictList.split(",").length);
|
||||
}else {
|
||||
sysMultistageDictPo.setGrade(0);
|
||||
}
|
||||
List<SysMultistageDictPo> sysMultistageDictPos = collect.get(sysMultistageDictPo.getMultistageDictCode());
|
||||
if (ObjectUtil.isNotEmpty(sysMultistageDictPos)){
|
||||
collect.remove(sysMultistageDictPo.getMultistageDictCode());
|
||||
sysMultistageDictPos = recursionMethod(sysMultistageDictPos, collect);
|
||||
sysMultistageDictPo.setSysMultistageDictPoList(sysMultistageDictPos);
|
||||
}
|
||||
}
|
||||
return treeList;
|
||||
}else {
|
||||
List<SysMultistageDictPo> sysMultistageDictPos = collect.get("");
|
||||
if (CollectionUtil.isNotEmpty(sysMultistageDictPos)){
|
||||
collect.remove("");
|
||||
treeList = recursionMethod(sysMultistageDictPos, collect);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归方法
|
||||
*
|
||||
* @param tree 父节点对象
|
||||
* @param treeList 所有的List
|
||||
*/
|
||||
public static SysMultistageDictPo findChildren(SysMultistageDictPo tree, List<SysMultistageDictPo> treeList) {
|
||||
List<SysMultistageDictPo> trees = treeList.stream().filter(e -> ObjectUtil.equal(e.getParentDictCode(),tree.getMultistageDictCode())).collect(Collectors.toList());
|
||||
if (!trees.isEmpty()){
|
||||
List<SysMultistageDictPo> list = new ArrayList<>();
|
||||
for (SysMultistageDictPo sysMultistageDictPo : trees) {
|
||||
SysMultistageDictPo children = findChildren(sysMultistageDictPo, treeList);
|
||||
list.add(children);
|
||||
}
|
||||
tree.setSysMultistageDictPoList(list);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典code,父级字典code 查询字典信息
|
||||
* @param sysMultistageDictDto
|
||||
* @return
|
||||
*/
|
||||
public SysMultistageDictPo getMultistageDictInfoByCode(SysMultistageDictDto sysMultistageDictDto) {
|
||||
return sysMultistageDictDomainService.getMultistageDictInfoByCode(sysMultistageDictDto);
|
||||
}
|
||||
|
||||
public SysMultistageDictPo getSysMultistageDictByCodeAndTopOrgId(String code, Long topOrgId) {
|
||||
return sysMultistageDictDomainService.getSysMultistageDictByCodeAndTopOrgId(code,topOrgId);
|
||||
}
|
||||
|
||||
public List<SysMultistageDict> getMultistageDictListByTopCodeAndTopOrgId(String topCode, Long topOrgId) {
|
||||
return sysMultistageDictDomainService.getMultistageDictListByTopCodeAndTopOrgId(topCode,topOrgId);
|
||||
}
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.common.entity.DataPermission;
|
||||
import com.mhd.basic.domain.sysMultistageDict.repository.po.SysMultistageDictPo;
|
||||
import com.mhd.basic.domain.sysPictureManage.entity.SysPictureManage;
|
||||
import com.mhd.basic.domain.sysPictureManage.repository.po.SysPictureManagePo;
|
||||
import com.mhd.basic.domain.sysPictureManage.repository.todo.SysPictureManageDo;
|
||||
import com.mhd.basic.domain.sysPictureManage.service.SysPictureManageDomainService;
|
||||
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.dto.SysMultistageDictDto;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.enums.PageBelongImgEnum;
|
||||
import com.mhd.common.core.enums.PictureTypeEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 图片管理Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-03-22
|
||||
*/
|
||||
@Service
|
||||
public class SysPictureManageApplicationService
|
||||
{
|
||||
@Autowired
|
||||
private SysPictureManageDomainService sysPictureManageDomainService;
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 查询图片管理
|
||||
*
|
||||
* @param sysPictureManageId 图片管理主键
|
||||
* @return 图片管理
|
||||
*/
|
||||
public SysPictureManagePo selectSysPictureManageBySysPictureManageId(Long sysPictureManageId)
|
||||
{
|
||||
return sysPictureManageDomainService.selectSysPictureManageBySysPictureManageId(sysPictureManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图片管理列表
|
||||
*
|
||||
* @param sysPictureManageDo 图片管理
|
||||
* @return 图片管理
|
||||
*/
|
||||
public List<SysPictureManagePo> selectSysPictureManageList(SysPictureManageDo sysPictureManageDo,DataPermission dataPermission)
|
||||
{
|
||||
//查询当前租户配置的
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
sysPictureManageDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
return sysPictureManageDomainService.selectSysPictureManageList(sysPictureManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图片管理
|
||||
* @param sysPictureManage
|
||||
* @return
|
||||
*/
|
||||
public boolean addPictureManage(SysPictureManage sysPictureManage) {
|
||||
//查询当前租户配置的
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
//补全数据字典信息
|
||||
completionDictionary(sysPictureManage);
|
||||
|
||||
sysPictureManage.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
return sysPictureManageDomainService.addPictureManage(sysPictureManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑图片管理
|
||||
* @param sysPictureManage
|
||||
* @return
|
||||
*/
|
||||
public boolean updatePictureManage(SysPictureManage sysPictureManage) {
|
||||
|
||||
//补全数据字典信息
|
||||
completionDictionary(sysPictureManage);
|
||||
|
||||
return sysPictureManageDomainService.updatePictureManage(sysPictureManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 补全数据字典信息
|
||||
*/
|
||||
public void completionDictionary(SysPictureManage sysPictureManage) {
|
||||
//补全所属门面
|
||||
SysMultistageDictDto sysMultistageDictDto = new SysMultistageDictDto();
|
||||
sysMultistageDictDto.setParentDictCode(PageBelongImgEnum.picture_management.getCode());
|
||||
AjaxResult belongPage = systemServiceFeign.selectMultistageDictList(sysMultistageDictDto);
|
||||
if ("200".equals(String.valueOf(belongPage.get("code")))) {
|
||||
List<SysMultistageDictPo> sysDictDataVoList = JSON.parseArray(JSONObject.toJSONString(belongPage.get("data")), SysMultistageDictPo.class);
|
||||
sysDictDataVoList.stream().filter(item -> ObjectUtil.equal(item.getMultistageDictCode(), sysPictureManage.getBelongPageCode())).findAny().ifPresent(belongDict -> sysPictureManage.setBelongPageValue(belongDict.getMultistageDictName()));
|
||||
}
|
||||
//补全图片类型
|
||||
sysMultistageDictDto.setParentDictCode(sysPictureManage.getBelongPageCode());
|
||||
AjaxResult pictureType = systemServiceFeign.selectMultistageDictList(sysMultistageDictDto);
|
||||
if ("200".equals(String.valueOf(pictureType.get("code")))) {
|
||||
List<SysMultistageDictPo> sysDictDataVoList = JSON.parseArray(JSONObject.toJSONString(pictureType.get("data")), SysMultistageDictPo.class);
|
||||
sysDictDataVoList.stream().filter(item -> ObjectUtil.equal(item.getMultistageDictCode(), sysPictureManage.getPictureTypeCode())).findAny().ifPresent(item -> sysPictureManage.setPictureTypeValue(item.getMultistageDictName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据图片id查询详情
|
||||
* @param sysPictureManageId
|
||||
* @return
|
||||
*/
|
||||
public SysPictureManagePo getPictureManageInfo(Long sysPictureManageId) {
|
||||
return sysPictureManageDomainService.getPictureManageInfo(sysPictureManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片管理信息
|
||||
* @param sysPictureManageDo
|
||||
* @return
|
||||
*/
|
||||
public boolean deletePictureManage(SysPictureManageDo sysPictureManageDo) {
|
||||
return sysPictureManageDomainService.deletePictureManage(sysPictureManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/停用
|
||||
* @param sysPictureManageDo
|
||||
* @return
|
||||
*/
|
||||
public boolean changePictureStatus(SysPictureManageDo sysPictureManageDo) {
|
||||
return sysPictureManageDomainService.changePictureStatus(sysPictureManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app首页轮播图
|
||||
*/
|
||||
public List<SysPictureManagePo> getAppHomeBannerList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysPictureManageDo sysPictureManageDo = new SysPictureManageDo();
|
||||
sysPictureManageDo.setBelongPageCode(PageBelongImgEnum.app_home.getCode());
|
||||
sysPictureManageDo.setPictureTypeCode(PictureTypeEnum.app_banner.getCode());
|
||||
sysPictureManageDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());//24-06-18 app轮播图根据所属组织来查询
|
||||
return sysPictureManageDomainService.selectSysPictureManageList(sysPictureManageDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取专线流程图列表
|
||||
*/
|
||||
public List<SysPictureManagePo> getLogisticsFlowChartList() {
|
||||
//查询当前租户配置的
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
//租户配置流程图
|
||||
SysPictureManageDo sysPictureManageDo = new SysPictureManageDo();
|
||||
sysPictureManageDo.setBelongPageCode(PageBelongImgEnum.logistics_flow_chart.getCode());
|
||||
sysPictureManageDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
sysPictureManageDo.setPictureStatus(1);
|
||||
List<SysPictureManagePo> tenantPictures = sysPictureManageDomainService.selectSysPictureManageList(sysPictureManageDo);
|
||||
return tenantPictures;
|
||||
|
||||
//系统默认流程图
|
||||
// sysPictureManageDo.setTopOrganizationId(0L);
|
||||
// List<SysPictureManagePo> sysPictures = sysPictureManageDomainService.selectSysPictureManageList(sysPictureManageDo);
|
||||
//
|
||||
// if (CollUtil.isEmpty(tenantPictures)) {
|
||||
// if (CollUtil.isEmpty(sysPictures)) {
|
||||
// throw new ServiceException("未设置系统默认流程图");
|
||||
// }
|
||||
// return sysPictures;
|
||||
// }
|
||||
//
|
||||
// Map<String, SysPictureManagePo> sys = sysPictures.stream().collect(Collectors.toMap(SysPictureManagePo::getPictureTypeCode, Function.identity(), (key1, key2) -> key2));
|
||||
//
|
||||
// Map<String, SysPictureManagePo> tenant = tenantPictures.stream().collect(Collectors.toMap(SysPictureManagePo::getPictureTypeCode, Function.identity(), (key1, key2) -> key2));
|
||||
//
|
||||
// if (sys.size() == tenant.size()) {
|
||||
// return tenantPictures;
|
||||
// }
|
||||
//
|
||||
// List<SysPictureManagePo> sysPictureManagePos = new ArrayList<>();
|
||||
// sys.forEach((key, value) -> {
|
||||
// sysPictureManagePos.add(tenant.getOrDefault(key, value));
|
||||
// });
|
||||
//
|
||||
// return sysPictureManagePos;
|
||||
}
|
||||
}
|
||||
+324
@@ -0,0 +1,324 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.interfaces.dto.SysProvinceCityCountyDTO;
|
||||
import com.mhd.basic.interfaces.facade.vo.SysAreaVO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.domain.areaAggregate.service.SysProvinceCityCountyDomainService;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description 维护省市县
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 14:10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysProvinceCityCountyApplicationService {
|
||||
|
||||
@Resource
|
||||
private SysProvinceCityCountyDomainService sysProvinceCityCountyDomainService;
|
||||
|
||||
/**
|
||||
* @Description 查询省列表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaPO> selectProvinceList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.selectProvinceAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增省
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean addProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.addProvince(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 修改省
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean updateProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.updateProvince(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 删除省
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public int deleteProvinceByIds(List<Long> ids) {
|
||||
return sysProvinceCityCountyDomainService.deleteProvinceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询城市list
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaPO> selectCityList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.selectCityAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增城市
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean addCity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.addCity(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 修改城市
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean updateCity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.updateCity(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 删除城市
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public int deleteCityByIds(List<Long> ids) {
|
||||
return sysProvinceCityCountyDomainService.deleteCityByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询区县list
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaPO> selectCountyList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.selectCountyAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 先增区县
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean addCounty(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.addCounty(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 修改区县
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public Boolean updateCounty(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
sysProvinceCityCountyDomainService.updateCounty(sysProvinceDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description 查询省市县三级
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaVO> selectAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
//数据查询全部数据
|
||||
List<SysAreaPO> list = sysProvinceCityCountyDomainService.selectAreaChildrenList(sysProvinceDO);
|
||||
//存储所有的地区
|
||||
Map<Long, SysAreaVO> areaTree = new HashMap<>();
|
||||
//查询所有地区列表
|
||||
List<SysAreaVO> arr = new ArrayList<>();
|
||||
for (SysAreaPO roleItrm : list) {
|
||||
SysAreaVO sysAreaVO = new SysAreaVO();
|
||||
BeanUtils.copyProperties(roleItrm, sysAreaVO);
|
||||
//将所有地区添加到 map 中
|
||||
areaTree.put(roleItrm.getAreaCode(), sysAreaVO);
|
||||
}
|
||||
areaTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
SysAreaVO sysAreaVO = item.getValue();
|
||||
if (sysAreaVO.getParentAreaCode() != null && sysAreaVO.getParentAreaCode() != 0) {
|
||||
//根据当前节点查询去map获取父级节点
|
||||
SysAreaVO vo = areaTree.get(sysAreaVO.getParentAreaCode());
|
||||
//判断是否有父级节点
|
||||
if (vo != null) {
|
||||
//给父级节点添加当前子
|
||||
vo.getChildren().add(sysAreaVO);
|
||||
}
|
||||
} else {
|
||||
// 所有一级节点
|
||||
arr.add(sysAreaVO);
|
||||
}
|
||||
});
|
||||
for (SysAreaVO vo : arr) {
|
||||
// 同步子数据
|
||||
vo.setChildren(areaTree.get(vo.getAreaCode()).getChildren());
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询省市县三级
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaVO> selectBranchAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
//数据查询全部数据
|
||||
List<SysAreaPO> list = sysProvinceCityCountyDomainService.selectBranchAreaChildrenList(sysProvinceDO);
|
||||
//存储所有的地区
|
||||
Map<Long, SysAreaVO> areaTree = new HashMap<>();
|
||||
//查询所有地区列表
|
||||
List<SysAreaVO> arr = new ArrayList<>();
|
||||
for (SysAreaPO roleItrm : list) {
|
||||
SysAreaVO sysAreaVO = new SysAreaVO();
|
||||
BeanUtils.copyProperties(roleItrm, sysAreaVO);
|
||||
//将所有地区添加到 map 中
|
||||
areaTree.put(roleItrm.getAreaCode(), sysAreaVO);
|
||||
}
|
||||
areaTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
SysAreaVO sysAreaVO = item.getValue();
|
||||
if (sysAreaVO.getParentAreaCode() != null && sysAreaVO.getParentAreaCode() != 0) {
|
||||
//根据当前节点查询去map获取父级节点
|
||||
SysAreaVO vo = areaTree.get(sysAreaVO.getParentAreaCode());
|
||||
//判断是否有父级节点
|
||||
if (vo != null) {
|
||||
//给父级节点添加当前子
|
||||
vo.getChildren().add(sysAreaVO);
|
||||
}
|
||||
} else {
|
||||
// 所有一级节点
|
||||
arr.add(sysAreaVO);
|
||||
}
|
||||
});
|
||||
for (SysAreaVO vo : arr) {
|
||||
// 同步子数据
|
||||
vo.setChildren(areaTree.get(vo.getAreaCode()).getChildren());
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询省市县三级
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaVO> selectAreaChildrenListApp(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
//数据查询全部数据
|
||||
List<SysAreaPO> list = sysProvinceCityCountyDomainService.selectAreaChildrenList(sysProvinceDO);
|
||||
//存储所有的地区
|
||||
Map<Long, SysAreaVO> areaTree = new HashMap<>();
|
||||
//查询所有地区列表
|
||||
List<SysAreaVO> arr = new ArrayList<>();
|
||||
for (SysAreaPO roleItrm : list) {
|
||||
SysAreaVO sysAreaVO = new SysAreaVO();
|
||||
BeanUtils.copyProperties(roleItrm, sysAreaVO);
|
||||
//将所有地区添加到 map 中
|
||||
areaTree.put(roleItrm.getAreaCode(), sysAreaVO);
|
||||
}
|
||||
areaTree.entrySet().forEach(item -> {
|
||||
//获取到当前节点
|
||||
SysAreaVO sysAreaVO = item.getValue();
|
||||
if (sysAreaVO.getParentAreaCode() != null && sysAreaVO.getParentAreaCode() != 0) {
|
||||
//根据当前节点查询去map获取父级节点
|
||||
SysAreaVO vo = areaTree.get(sysAreaVO.getParentAreaCode());
|
||||
//判断是否有父级节点
|
||||
if (vo != null) {
|
||||
//给父级节点添加当前子
|
||||
vo.getChildren().add(sysAreaVO);
|
||||
}
|
||||
} else {
|
||||
// 所有一级节点
|
||||
arr.add(sysAreaVO);
|
||||
}
|
||||
});
|
||||
for (SysAreaVO vo : arr) {
|
||||
// 同步子数据
|
||||
vo.setChildren(areaTree.get(vo.getAreaCode()).getChildren());
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询省市县一级
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:52
|
||||
*/
|
||||
public List<SysAreaPO> selectAllAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.selectAllAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfo(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if(ObjectUtil.isNotEmpty(sysProvinceDO.getCountyCode()) && sysProvinceDO.getCountyCode()!=0){
|
||||
return sysProvinceCityCountyDomainService.findAreaInfo(sysProvinceDO);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfoByCityCode(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.findAreaInfoByCityCode(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfoByProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceCityCountyDomainService.findAreaInfoByProvince(sysProvinceDO);
|
||||
}
|
||||
|
||||
public Map<String, String> selectSsqhList() {
|
||||
//数据查询全部数据
|
||||
List<SysAreaPO> list = sysProvinceCityCountyDomainService.selectSsqhList();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
list.forEach(e-> map.put(e.getAreaCode().toString(), e.getAreaName()));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code编码删除省市县
|
||||
*/
|
||||
@Transactional
|
||||
public void deleteCountyByCodes(SysProvinceCityCountyDTO sysProvinceDTO) {
|
||||
if(!StringUtils.isNotEmpty(sysProvinceDTO.getAreaCodes())){
|
||||
throw new ServiceException("省市县编码不能为空");
|
||||
}
|
||||
List<String> codes = Stream.of(sysProvinceDTO.getAreaCodes().split(",")).collect(Collectors.toList());
|
||||
for (String code : codes) {
|
||||
//判断省市县编码
|
||||
if(code.length()==2){
|
||||
//删除省份
|
||||
sysProvinceCityCountyDomainService.deleteprovinceByCode(code);
|
||||
}else if(code.length()==4){
|
||||
//删除市
|
||||
sysProvinceCityCountyDomainService.deleteCityByCode(code);
|
||||
}else if(code.length()==6){
|
||||
//删除县区
|
||||
sysProvinceCityCountyDomainService.deleteCountryByCode(code);
|
||||
}else {
|
||||
throw new ServiceException("省市县编码格式不正确");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.userConfigSwitch.repository.po.UserConfigSwitchAuthAppPo;
|
||||
import com.mhd.basic.domain.userConfigSwitch.repository.po.UserConfigSwitchPo;
|
||||
import com.mhd.basic.domain.userConfigSwitch.repository.todo.UserConfigSwitchDo;
|
||||
import com.mhd.basic.domain.userConfigSwitch.service.UserConfigSwitchDomainService;
|
||||
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.common.core.constant.CacheConstants;
|
||||
import com.mhd.common.core.constant.Constants;
|
||||
import com.mhd.common.core.domain.entity.OrgProductConfig;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.entity.SysConfigSwitch;
|
||||
import com.mhd.common.core.domain.po.ConfigSwitchPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.thirdparty.SysDepartInterfaceInfoPo;
|
||||
import com.mhd.common.core.domain.thirdparty.SysDepartInterfaceInfoDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 开关配置ApplicationService
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserConfigSwitchApplicationService {
|
||||
@Autowired
|
||||
private UserConfigSwitchDomainService userConfigSwitchDomainService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
@Autowired
|
||||
private WlhyServiceFeign wlhyServiceFeign;
|
||||
@Autowired
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询开关配置列表
|
||||
*/
|
||||
|
||||
public List<UserConfigSwitchPo> queryList(UserConfigSwitchDo userConfigSwitchDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
userConfigSwitchDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return userConfigSwitchDomainService.queryList(userConfigSwitchDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增开关配置
|
||||
*/
|
||||
public Boolean insert(UserConfigSwitchDo userConfigSwitchDo) {
|
||||
//获取登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
UserConfigSwitchPo userConfigSwitchInfo = getUserConfigSwitchInfo();
|
||||
if (ObjectUtil.isNotNull(userConfigSwitchInfo) && ObjectUtil.equal(userConfigSwitchInfo.getOrganizationId(), loginUser.getUserPo().getOrganizationId())) {
|
||||
userConfigSwitchDo.setUserConfigSwitchId(userConfigSwitchInfo.getUserConfigSwitchId());
|
||||
return userConfigSwitchDomainService.update(userConfigSwitchDo);
|
||||
} else {
|
||||
userConfigSwitchDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
userConfigSwitchDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
return userConfigSwitchDomainService.insert(userConfigSwitchDo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改开关配置
|
||||
*/
|
||||
public Boolean update(UserConfigSwitchDo userConfigSwitchDo) {
|
||||
//获取登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserConfigSwitchPo userConfigSwitchInfo = getUserConfigSwitchInfo();
|
||||
if (ObjectUtil.isNull(userConfigSwitchInfo)) {
|
||||
throw new ServiceException("获取开关配置信息失败");
|
||||
}
|
||||
boolean flag;
|
||||
//判断是否是当前组织配置,如果是,则修改当前信息,如果不是,则新增
|
||||
if (ObjectUtil.equal(userConfigSwitchInfo.getOrganizationId(), loginUser.getUserPo().getOrganizationId())) {
|
||||
flag = userConfigSwitchDomainService.update(userConfigSwitchDo);
|
||||
} else {
|
||||
flag = userConfigSwitchDomainService.insert(userConfigSwitchDo);
|
||||
}
|
||||
UserConfigSwitchPo userConfigSwitchPo = userConfigSwitchDomainService.getInfo(userConfigSwitchDo.getUserConfigSwitchId());
|
||||
|
||||
//使用通用类保存到redis,防止转换报错
|
||||
com.mhd.common.core.domain.po.UserConfigSwitchPo newUserConfigSwitchPo = new com.mhd.common.core.domain.po.UserConfigSwitchPo();
|
||||
BeanUtils.copyProperties(userConfigSwitchPo, newUserConfigSwitchPo);
|
||||
//这里将修改后的配置文件,更新到redis中
|
||||
redisService.setCacheObject(CacheConstants.USER_COMFIG_SWITCH_KEY + loginUser.getUserPo().getOrganizationId(), newUserConfigSwitchPo);
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除开关配置
|
||||
*/
|
||||
public Boolean delete(Long[] userConfigSwitchIds) {
|
||||
return userConfigSwitchDomainService.delete(userConfigSwitchIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开关配置详细信息
|
||||
*/
|
||||
public UserConfigSwitchPo getInfo(Long userConfigSwitchId)
|
||||
{
|
||||
return userConfigSwitchDomainService.getInfo(userConfigSwitchId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前租户开关配置信息
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchPo getUserConfigSwitchInfo() {
|
||||
UserConfigSwitchDo userConfigSwitchDo = new UserConfigSwitchDo();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
//先获取当前组织配置,没有则向上查询
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
userConfigSwitchDo.setOrganizationId(organizationId);
|
||||
UserConfigSwitchPo userConfigSwitchInfo = userConfigSwitchDomainService.getUserConfigSwitchInfo(userConfigSwitchDo);
|
||||
if (ObjectUtil.isNull(userConfigSwitchInfo)) {
|
||||
AjaxResult result = productServiceFeign.selectTopOrganizationList(organizationId);
|
||||
List<Long> orgList = new ArrayList<>();
|
||||
if ("200".equals(String.valueOf(result.get("code")))) {
|
||||
orgList = JSON.parseArray(JSONObject.toJSONString(result.get("data")), Long.class);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(orgList)) {
|
||||
for (Long aLong : orgList) {
|
||||
userConfigSwitchInfo = userConfigSwitchDomainService.getUserConfigSwitchInfoByOrganizationId(aLong);
|
||||
if (ObjectUtil.isNotNull(userConfigSwitchInfo) && userConfigSwitchInfo.getUserConfigSwitchId() != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return userConfigSwitchInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前租户开关配置信息
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchPo getUserConfigSwitchInfo(Long organizationId) {
|
||||
UserConfigSwitchDo userConfigSwitchDo = new UserConfigSwitchDo();
|
||||
userConfigSwitchDo.setOrganizationId(organizationId);
|
||||
UserConfigSwitchPo userConfigSwitchInfo = userConfigSwitchDomainService.getUserConfigSwitchInfo(userConfigSwitchDo);
|
||||
if (ObjectUtil.isNull(userConfigSwitchInfo)){
|
||||
throw new ServiceException("获取开关配置信息失败");
|
||||
}
|
||||
return userConfigSwitchInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* APP获取当前用户对应租户的开关配置信息
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchAuthAppPo getAppUserConfigSwitchInfo() {
|
||||
UserConfigSwitchDo userConfigSwitchDo = new UserConfigSwitchDo();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
// userConfigSwitchDo.setTopOrganizationId(2L);
|
||||
userConfigSwitchDo.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
UserConfigSwitchAuthAppPo userConfigSwitchAuthAppPo=userConfigSwitchDomainService.getAppUserConfigSwitchInfo(userConfigSwitchDo);
|
||||
userConfigSwitchAuthAppPo.setIsDriverBidding(userPo.getIsDriverBidding());
|
||||
return userConfigSwitchAuthAppPo;
|
||||
}
|
||||
|
||||
public ConfigSwitchPO getConfigSwitchByLogin() {
|
||||
ConfigSwitchPO configSwitchPO = new ConfigSwitchPO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//先获取当前组织配置,没有则向上查询
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
UserConfigSwitchDo userConfigSwitchDo = new UserConfigSwitchDo();
|
||||
userConfigSwitchDo.setOrganizationId(organizationId);
|
||||
UserConfigSwitchPo userConfigSwitchInfo = userConfigSwitchDomainService.getUserConfigSwitchInfo(userConfigSwitchDo);
|
||||
if (ObjectUtil.isNull(userConfigSwitchInfo)) {
|
||||
userConfigSwitchInfo = userConfigSwitchDomainService.getUserConfigSwitchInfoByOrganizationId(topOrganizationId);
|
||||
if (userConfigSwitchInfo == null) {
|
||||
throw new ServiceException("未获取到配置信息,请联系管理员进行配置!");
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(userConfigSwitchInfo, configSwitchPO);
|
||||
//检查是否开启网货
|
||||
boolean flag = checkSwitch();
|
||||
if(!flag){
|
||||
//如果未配置网货产品,返回跳过
|
||||
return configSwitchPO;
|
||||
}
|
||||
R<SysConfigSwitch> configByLogin = wlhyServiceFeign.getConfigByLogin();
|
||||
if (configByLogin.getCode() == Constants.SUCCESS) {
|
||||
SysConfigSwitch data = configByLogin.getData();
|
||||
org.springframework.beans.BeanUtils.copyProperties(data, configSwitchPO, IgnoreNullUtil.getNullPropertyNames(data));
|
||||
}else {
|
||||
throw new ServiceException("获取网货配置信息失败:"+configByLogin.getMsg());
|
||||
}
|
||||
//查询电子围栏的半径信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("electronic_fence");
|
||||
sysDepartInterfaceInfoDTO.setInterfaceTypeKey("electronic_fence");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
if (CollUtil.isEmpty(sysDepartInterfaceInfoPos) || sysDepartInterfaceInfoPos.size() < 1) {
|
||||
configSwitchPO.setElectronicFence(BigDecimal.ZERO);
|
||||
} else {
|
||||
String interfaceTypeValue = sysDepartInterfaceInfoPos.get(0).getInterfaceTypeValue();
|
||||
BigDecimal electronicFence = new BigDecimal(interfaceTypeValue);
|
||||
configSwitchPO.setElectronicFence(electronicFence);
|
||||
}
|
||||
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("electronic_fence");
|
||||
sysDepartInterfaceInfoDTO.setInterfaceTypeKey("electronic_fence_load");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPosLoad = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
if (CollUtil.isEmpty(sysDepartInterfaceInfoPosLoad) || sysDepartInterfaceInfoPosLoad.size() < 1) {
|
||||
configSwitchPO.setElectronicFenceLoad(BigDecimal.ZERO);
|
||||
} else {
|
||||
String interfaceTypeValue = sysDepartInterfaceInfoPosLoad.get(0).getInterfaceTypeValue();
|
||||
BigDecimal electronicFenceLoad = new BigDecimal(interfaceTypeValue);
|
||||
configSwitchPO.setElectronicFenceLoad(electronicFenceLoad);
|
||||
}
|
||||
return configSwitchPO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验是否配置网货产品
|
||||
* @return true-开启,false-关闭
|
||||
*/
|
||||
private boolean checkSwitch() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
String key = CacheConstants.ORG_PRODUCT_KEY + loginUser.getUserPo().getTopOrganizationId();
|
||||
OrgProductConfig orgProductConfig = redisService.getCacheObject(key);
|
||||
if(null == orgProductConfig) {
|
||||
return false;
|
||||
}
|
||||
//配置网货
|
||||
return orgProductConfig.getWlhyFlag() == 1;
|
||||
}
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.mhd.basic.domain.userConfigSwitch.repository.po.UserConfigSwitchPo;
|
||||
import com.mhd.basic.interfaces.dto.UserFormConfigDto;
|
||||
import com.mhd.basic.domain.userFormConfig.entity.UserFormConfig;
|
||||
import com.mhd.basic.domain.userFormConfig.repository.po.UserFormConfigJsonPo;
|
||||
import com.mhd.basic.domain.userFormConfig.repository.po.UserFormConfigPo;
|
||||
import com.mhd.basic.domain.userFormConfig.repository.todo.UserFormConfigDo;
|
||||
import com.mhd.basic.domain.userFormConfig.service.UserFormConfigDomainService;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户自定义单配置ApplicationService
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-13
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserFormConfigApplicationService {
|
||||
@Autowired
|
||||
private UserFormConfigDomainService userFormConfigDomainService;
|
||||
@Autowired
|
||||
private UserConfigSwitchApplicationService userConfigSwitchApplicationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询用户自定义单配置列表
|
||||
*/
|
||||
|
||||
public List<UserFormConfigPo> queryList(UserFormConfigDo userFormConfigDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
userFormConfigDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return userFormConfigDomainService.queryList(userFormConfigDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户自定义单配置
|
||||
*/
|
||||
public Boolean insert(UserFormConfigDo userFormConfigDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
userFormConfigDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
userFormConfigDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
return userFormConfigDomainService.insert(userFormConfigDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户自定义单配置
|
||||
*/
|
||||
public Boolean update(UserFormConfigDo userFormConfigDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
userFormConfigDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
userFormConfigDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
return userFormConfigDomainService.update(userFormConfigDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义单配置
|
||||
*/
|
||||
public Boolean delete(UserFormConfigDto userFormConfigDto) {
|
||||
return userFormConfigDomainService.delete(userFormConfigDto.getUserFormConfigId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户自定义单配置详细信息
|
||||
*/
|
||||
public UserFormConfigPo getInfo(Long userFormConfigId)
|
||||
{
|
||||
return userFormConfigDomainService.getInfo(userFormConfigId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*APP获取租户自定义单配置
|
||||
* @param userFormConfigDto
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getUserFromConfig(UserFormConfigDto userFormConfigDto) {
|
||||
if(userFormConfigDto.getFormType()==null){
|
||||
throw new ServiceException("表单类型不能为空");
|
||||
}
|
||||
Map<String,Object> res = new HashMap<>();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//查询当前登录人所在的租户
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
UserFormConfigDo userFormConfigDo = new UserFormConfigDo();
|
||||
BeanUtils.copyProperties(userFormConfigDto,userFormConfigDo);
|
||||
userFormConfigDo.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
UserFormConfig userFormConfig = userFormConfigDomainService.selectConfigByIdAndType(userFormConfigDo);
|
||||
if(null == userFormConfig){
|
||||
//如果当前租户没有配置,则查询平台的
|
||||
userFormConfigDo.setTopOrganizationId(0L);
|
||||
userFormConfig = userFormConfigDomainService.selectConfigByIdAndType(userFormConfigDo);
|
||||
}
|
||||
String jsonString = userFormConfig.getFormJson();
|
||||
//json转对象
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonString);
|
||||
List<UserFormConfigJsonPo> formList = jsonArray.toJavaList(UserFormConfigJsonPo.class);
|
||||
if(formList != null && formList.size()>0){
|
||||
for (UserFormConfigJsonPo userFormConfigJsonPo : formList) {
|
||||
res.put(userFormConfigJsonPo.getField(),JSON.toJSON(userFormConfigJsonPo));
|
||||
}
|
||||
}
|
||||
//只有承运人才显示该字段
|
||||
if (userFormConfigDto.getFormType() != null && ObjectUtil.equal(userFormConfigDto.getFormType(),1)){
|
||||
//获取配置判断是否开启推广码
|
||||
UserConfigSwitchPo userConfigSwitchInfo = userConfigSwitchApplicationService.getUserConfigSwitchInfo();
|
||||
//开启则添加推广码字段
|
||||
if (userConfigSwitchInfo != null && userConfigSwitchInfo.getIsPromoCode() == 1){
|
||||
UserFormConfigJsonPo userFormConfigJsonPo = new UserFormConfigJsonPo();
|
||||
userFormConfigJsonPo.setAuth("");
|
||||
userFormConfigJsonPo.setField("promoCode");
|
||||
userFormConfigJsonPo.setNotNull("2");
|
||||
userFormConfigJsonPo.setPcShow("");
|
||||
userFormConfigJsonPo.setRule("2");
|
||||
userFormConfigJsonPo.setShow("1");
|
||||
userFormConfigJsonPo.setTitle("推广码");
|
||||
res.put(userFormConfigJsonPo.getField(),JSON.toJSON(userFormConfigJsonPo));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取PC端租户表单配置
|
||||
* @param userFormConfigDto
|
||||
* @return
|
||||
*/
|
||||
public String getPcUserFromConfig(UserFormConfigDto userFormConfigDto) {
|
||||
if(userFormConfigDto.getFormType()==null){
|
||||
throw new ServiceException("表单类型不能为空");
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//查询当前登录人所在的租户
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
UserFormConfigDo userFormConfigDo = new UserFormConfigDo();
|
||||
BeanUtils.copyProperties(userFormConfigDto,userFormConfigDo);
|
||||
userFormConfigDo.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
UserFormConfig userFormConfig = userFormConfigDomainService.selectConfigByIdAndType(userFormConfigDo);
|
||||
if(null == userFormConfig){
|
||||
throw new ServiceException("租户表单配置信息未找到");
|
||||
}
|
||||
return userFormConfig.getFormJson();
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.mhd.basic.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mhd.basic.domain.matter.repository.po.StatisticalMattersPo;
|
||||
import com.mhd.basic.infrastructure.websocket.WebSocket;
|
||||
import com.mhd.common.core.domain.dto.WebSocketDTO;
|
||||
import com.mhd.common.core.enums.WebsocketTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* WebSocket应用服务层
|
||||
*/
|
||||
@Async
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WebSocketApplicationService {
|
||||
|
||||
@Autowired
|
||||
private WebSocket webSocket;
|
||||
|
||||
@Autowired
|
||||
private MatterApplicationService matterApplicationService;
|
||||
|
||||
/**
|
||||
* 群发消息
|
||||
*/
|
||||
public void bulkSend(WebSocketDTO webSocketDTO) {
|
||||
List<String> ids = webSocketDTO.getUserIds();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("type", webSocketDTO.getType());
|
||||
map.put("data", webSocketDTO.getData());
|
||||
String message = JSONUtil.toJsonStr(map);
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
webSocket.sendMoreMessage(ids, message);
|
||||
} else {
|
||||
webSocket.sendAllMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个消息
|
||||
*/
|
||||
public void oneSend(WebSocketDTO webSocketDTO) {
|
||||
String userId = webSocketDTO.getUserId();
|
||||
Long organizationId = webSocketDTO.getOrganizationId();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("type", webSocketDTO.getType());
|
||||
map.put("data", webSocketDTO.getData());
|
||||
String message = JSONUtil.toJsonStr(map);
|
||||
webSocket.sendOneMessage(userId, message);
|
||||
|
||||
//是否发送事项列表
|
||||
if (StrUtil.equals(webSocketDTO.getListFlag(), "1")) {
|
||||
StatisticalMattersPo statisticalMattersPo = matterApplicationService.statisticalMatters(organizationId);
|
||||
Map<String, Object> Matters = new HashMap<>();
|
||||
Matters.put("type", WebsocketTypeEnum.TO_DO_LIST.getCode());
|
||||
Matters.put("data", statisticalMattersPo);
|
||||
webSocket.sendOneMessage(userId, JSONUtil.toJsonStr(Matters));
|
||||
}
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.mhd.basic.application.service.abnormalAddressBook;
|
||||
|
||||
import com.mhd.basic.application.service.SysProvinceCityCountyApplicationService;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.entity.AbnormalAddressBook;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.po.AbnormalAddressBookPO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.todo.AbnormalAddressBookDO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.service.AbnormalAddressBookDomainService;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.interfaces.dto.abnormalAddressBook.AbnormalAddressBookDTO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.mapper.SysUserMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 异常匹配地址簿ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AbnormalAddressBookApplicationService {
|
||||
@Autowired
|
||||
private AbnormalAddressBookDomainService abnormalAddressBookDomainService;
|
||||
@Autowired
|
||||
private SysProvinceCityCountyApplicationService sysProvinceCityCountyApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询异常匹配地址簿列表
|
||||
*/
|
||||
|
||||
public List<AbnormalAddressBookPO> queryList(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1L){
|
||||
abnormalAddressBookDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return abnormalAddressBookDomainService.queryList(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增异常匹配地址簿
|
||||
*/
|
||||
public Boolean insert(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
|
||||
return abnormalAddressBookDomainService.insert(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常匹配地址簿
|
||||
*/
|
||||
public Boolean update(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
if (StringUtils.isNotBlank(abnormalAddressBookDO.getActualAreaId())){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(Long.parseLong(abnormalAddressBookDO.getActualAreaId()));
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
abnormalAddressBookDO.setActualAreaName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
return abnormalAddressBookDomainService.update(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除异常匹配地址簿
|
||||
*/
|
||||
public boolean delete(Long[] abnormalAddressBookIds) {
|
||||
return abnormalAddressBookDomainService.delete(abnormalAddressBookIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常匹配地址簿详细信息
|
||||
*/
|
||||
public AbnormalAddressBookPO getInfo(Long abnormalAddressBookId)
|
||||
{
|
||||
return abnormalAddressBookDomainService.getInfo(abnormalAddressBookId);
|
||||
}
|
||||
|
||||
|
||||
public int saveBatchAddressBook(List<AbnormalAddressBookDTO> abnormalAddressBookDTOList) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(null == loginUser){
|
||||
throw new ServiceException("获取登录人失败");
|
||||
}
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
List<AbnormalAddressBook> list = new ArrayList<>();
|
||||
for (AbnormalAddressBookDTO abnormalAddressBookDTO : abnormalAddressBookDTOList) {
|
||||
AbnormalAddressBook abnormalAddressBook = new AbnormalAddressBook();
|
||||
BeanUtils.copyProperties(abnormalAddressBookDTO, abnormalAddressBook);
|
||||
abnormalAddressBook.setAuditBy(userPo.getCreateBy());
|
||||
abnormalAddressBook.setAuditByName(userPo.getCreateByName());
|
||||
list.add(abnormalAddressBook);
|
||||
}
|
||||
abnormalAddressBookDomainService.saveBatchAddressBook(list);
|
||||
return abnormalAddressBookDTOList.size();
|
||||
}
|
||||
|
||||
public AbnormalAddressBookDTO matchAddressBook(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
AbnormalAddressBookPO abnormalAddressBookPO = abnormalAddressBookDomainService.matchAddressBook(abnormalAddressBookDO);
|
||||
if (abnormalAddressBookPO == null || abnormalAddressBookPO.getAbnormalAddressBookId() == null){
|
||||
throw new ServiceException("匹配失败!");
|
||||
}
|
||||
AbnormalAddressBookDTO abnormalAddressBookDTO = new AbnormalAddressBookDTO();
|
||||
BeanUtils.copyProperties(abnormalAddressBookPO, abnormalAddressBookDTO);
|
||||
return abnormalAddressBookDTO;
|
||||
}
|
||||
}
|
||||
+559
@@ -0,0 +1,559 @@
|
||||
package com.mhd.basic.application.service.addressBook;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.basic.application.service.SysProvinceCityCountyApplicationService;
|
||||
import com.mhd.basic.domain.addressBook.entity.AddressBook;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.common.core.domain.po.AddressBookPo;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.basic.domain.addressBook.service.AddressBookDomainService;
|
||||
import com.mhd.basic.domain.addressBook.service.CommonRouteDomainService;
|
||||
import com.mhd.basic.domain.addressBook.todo.CommonRouteDo;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.interfaces.assember.addressBook.AddressBookAssembler;
|
||||
import com.mhd.basic.interfaces.dto.addressBook.AddressBookDto;
|
||||
import com.mhd.basic.interfaces.dto.addressBook.CommonRouteDto;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.distanceUtil.DistanceUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地址簿 应用服务层
|
||||
*
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class AddressBookApplicationService
|
||||
{
|
||||
@Autowired
|
||||
private AddressBookDomainService addressBookDomainService;
|
||||
@Autowired
|
||||
private SysProvinceCityCountyApplicationService sysProvinceCityCountyApplicationService;
|
||||
@Autowired
|
||||
private CommonRouteDomainService commonRouteDomainService;
|
||||
|
||||
/**
|
||||
* 查询地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 地址簿
|
||||
*/
|
||||
public AddressBookPo selectAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
return addressBookDomainService.selectAddressBookByAddressBookId(addressBookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地址簿列表
|
||||
*
|
||||
* @param addressBookPo 地址簿
|
||||
* @return 地址簿
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookList(AddressBookPo addressBookPo)
|
||||
{
|
||||
// 获取登录人id
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
addressBookPo.setUserId(userId);
|
||||
return addressBookDomainService.selectAddressBookList(addressBookPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAddressBook(AddressBook addressBook)
|
||||
{
|
||||
// 获取登录人id
|
||||
Long userId = new Long("19");
|
||||
userId = SecurityUtils.getLoginUser().getUserid();
|
||||
addressBook.setUserId(userId);
|
||||
if(addressBook.getCountyCode() != null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(addressBook.getCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
addressBook.setAreaName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
return addressBookDomainService.insertAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAddressBook(AddressBook addressBook)
|
||||
{
|
||||
if(addressBook.getCountyCode() != null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(addressBook.getCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
addressBook.setAreaName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
return addressBookDomainService.updateAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地址簿
|
||||
*
|
||||
* @param addressBookIds 需要删除的地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookIds(Long[] addressBookIds)
|
||||
{
|
||||
int i = 1;
|
||||
if(addressBookIds != null && addressBookIds.length > 0){
|
||||
for (Long addressBookId : addressBookIds) {
|
||||
AddressBook addressBook = new AddressBook();
|
||||
addressBook.setAddressBookId(addressBookId);
|
||||
addressBook.setDelFlag(2);
|
||||
addressBookDomainService.updateAddressBook(addressBook);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址簿信息
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
AddressBook addressBook = new AddressBook();
|
||||
addressBook.setAddressBookId(addressBookId);
|
||||
addressBook.setDelFlag(2);
|
||||
return addressBookDomainService.updateAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线集合
|
||||
*
|
||||
* @param commonRouteDo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRouteDo commonRouteDo){
|
||||
// 获取登录人id
|
||||
// Long userId = SecurityUtils.getUserId()==0 ? 4L:SecurityUtils.getLoginUser().getUserid();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
commonRouteDo.setCreateBy(userId);
|
||||
return commonRouteDomainService.selectCommonRouteList(commonRouteDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用路线
|
||||
*
|
||||
* @param commonRouteDto 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean insertCommonRoute(CommonRouteDto commonRouteDto){
|
||||
/*
|
||||
常用路线:APP可以从地址簿选择,也可以地图选点,如果从地址簿选择,则APP传id过来,接口直接查询后给数据赋值
|
||||
如果前端不传id,则直接保存APP传来的地址信息
|
||||
*/
|
||||
CommonRoute commonRoute = new AddressBookAssembler().toDo(commonRouteDto);
|
||||
// 获取登录人id
|
||||
Long userId = new Long("19");
|
||||
userId = SecurityUtils.getLoginUser().getUserid();
|
||||
commonRoute.setUserId(userId);
|
||||
//组装省市县信息
|
||||
assembleCountyName(commonRoute);
|
||||
//组装地址信息
|
||||
assembleAddressInfo(commonRoute);
|
||||
return commonRouteDomainService.insertCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装省市县信息
|
||||
* @param commonRoute
|
||||
*/
|
||||
private CommonRoute assembleCountyName(CommonRoute commonRoute) {
|
||||
if(commonRoute.getMailCountyCode() != null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(commonRoute.getMailCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
commonRoute.setMailCountyName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
if(commonRoute.getAddresseeCountyCode() !=null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(commonRoute.getAddresseeCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
commonRoute.setAddresseeCountyName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
return commonRoute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装地址信息
|
||||
* @param commonRoute
|
||||
*/
|
||||
private CommonRoute assembleAddressInfo(CommonRoute commonRoute) {
|
||||
if(commonRoute.getSendAddressId()!=null){
|
||||
//发货地址簿id不为空,则查询地址簿信息
|
||||
LambdaQueryWrapper<AddressBook> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AddressBook::getAddressBookId,commonRoute.getSendAddressId());
|
||||
AddressBook addressBook = addressBookDomainService.selectOneByLambda(queryWrapper);
|
||||
//查询地址簿信息,如果地址簿被删除,则保存常用线路时,清空地址簿id字段
|
||||
if(addressBook.getDelFlag()!=1){
|
||||
commonRoute.setSendAddressId(null);
|
||||
}
|
||||
commonRoute.setMailCountyCode(addressBook.getCountyCode());
|
||||
commonRoute.setMailCountyName(addressBook.getCountyName());
|
||||
commonRoute.setMailDoorplate(addressBook.getDoorplate());
|
||||
commonRoute.setSendLatitude(addressBook.getLatitude());
|
||||
commonRoute.setSendLongitude(addressBook.getLongitude());
|
||||
commonRoute.setMailAddress(addressBook.getAddress());
|
||||
commonRoute.setMailName(addressBook.getLinkMan());
|
||||
commonRoute.setMailPhone(addressBook.getLinkPhone());
|
||||
commonRoute.setMailAddressPlot(addressBook.getAddressPlot());
|
||||
}
|
||||
if(commonRoute.getReceiveAddressId()!=null){
|
||||
//收货地址簿id不为空,则查询地址簿信息
|
||||
LambdaQueryWrapper<AddressBook> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AddressBook::getAddressBookId,commonRoute.getReceiveAddressId());
|
||||
AddressBook addressBook = addressBookDomainService.selectOneByLambda(queryWrapper);
|
||||
if(addressBook.getDelFlag()!=1){
|
||||
commonRoute.setReceiveAddressId(null);
|
||||
}
|
||||
commonRoute.setAddresseeName(addressBook.getLinkMan());
|
||||
commonRoute.setAddresseePhone(addressBook.getLinkPhone());
|
||||
commonRoute.setAddresseeCountyCode(addressBook.getCountyCode());
|
||||
commonRoute.setAddresseeCountyName(addressBook.getCountyName());
|
||||
commonRoute.setAddresseeAddress(addressBook.getAddress());
|
||||
commonRoute.setAddresseeDoorplate(addressBook.getDoorplate());
|
||||
commonRoute.setReceiveLatitude(addressBook.getLatitude());
|
||||
commonRoute.setReceiveLongitude(addressBook.getLongitude());
|
||||
commonRoute.setAddresseeAddressPlot(addressBook.getAddressPlot());
|
||||
}
|
||||
//计算距离
|
||||
if (commonRoute.getSendLongitude() != null && commonRoute.getSendLatitude() != null
|
||||
&& commonRoute.getReceiveLongitude() != null && commonRoute.getReceiveLatitude() != null){
|
||||
BigDecimal distance = calculateDistance(commonRoute.getSendLongitude(), commonRoute.getSendLatitude(), commonRoute.getReceiveLongitude(), commonRoute.getReceiveLatitude());
|
||||
commonRoute.setHaulDistance(distance);
|
||||
}
|
||||
//保存线路名称
|
||||
if (StringUtils.isBlank(commonRoute.getLineName()) && commonRoute.getMailCountyName() != null && commonRoute.getAddresseeCountyName() != null){
|
||||
commonRoute.setLineName(commonRoute.getMailCountyName() + "-" + commonRoute.getAddresseeCountyName());
|
||||
}
|
||||
return commonRoute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用路线
|
||||
*
|
||||
* @param commonRouteDto 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateCommonRoute(CommonRouteDto commonRouteDto){
|
||||
CommonRoute commonRoute = new AddressBookAssembler().toDo(commonRouteDto);
|
||||
//组装省市县信息
|
||||
assembleCountyName(commonRoute);
|
||||
//组装地址信息
|
||||
assembleAddressInfo(commonRoute);
|
||||
return commonRouteDomainService.updateCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址簿
|
||||
* @param addressBookDto
|
||||
* @return
|
||||
*/
|
||||
public int deleteAddressBookById(AddressBookDto addressBookDto) {
|
||||
if(addressBookDto.getAddressBookId()==null){
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
return addressBookDomainService.deleteAddressBookById(addressBookDto.getAddressBookId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除常用线路
|
||||
* @param commonRouteDto
|
||||
* @return
|
||||
*/
|
||||
public boolean removeCommonRouteById(CommonRouteDto commonRouteDto) {
|
||||
if(commonRouteDto.getCommonRouteId()==null){
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
return commonRouteDomainService.removeCommonRouteById(commonRouteDto.getCommonRouteId());
|
||||
}
|
||||
/**
|
||||
* 根据货单id查询地址簿列表
|
||||
*
|
||||
* @param manifestId 货单id
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookListByManifestId(Long manifestId){
|
||||
return addressBookDomainService.selectAddressBookListByManifestId(manifestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线
|
||||
*
|
||||
* @param commonRouteId 常用路线主键
|
||||
* @return 常用路线
|
||||
*/
|
||||
public CommonRoutePo selectCommonRouteByCommonRouteId(Long commonRouteId)
|
||||
{
|
||||
return commonRouteDomainService.selectCommonRouteByCommonRouteId(commonRouteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用线路(地址簿不存在的情况直接新增,同步添加地址簿)
|
||||
* @param commonRouteDto
|
||||
* @return
|
||||
*/
|
||||
public boolean addCommonRouteAndAddressBook(CommonRouteDto commonRouteDto) {
|
||||
// 获取登录人id
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if (commonRouteDto.getUserId() == null){
|
||||
commonRouteDto.setUserId(loginUser.getUserid());
|
||||
}
|
||||
if(commonRouteDto.getMailCountyCode() != null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(commonRouteDto.getMailCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
commonRouteDto.setMailCountyName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
if(commonRouteDto.getAddresseeCountyCode() !=null){
|
||||
SysProvinceCityCountyDO sysProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
sysProvinceCityCountyDO.setCountyCode(commonRouteDto.getMailCountyCode());
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyApplicationService.findAreaInfo(sysProvinceCityCountyDO);
|
||||
if (sysAreaPO != null){
|
||||
commonRouteDto.setAddresseeCountyName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
if (commonRouteDto.getCommonRouteId() == null){
|
||||
//默认添加地址簿,先匹配是否有相同的地址簿,有则直接取值
|
||||
if (commonRouteDto.getAddAddressBookFlag() == null || commonRouteDto.getAddAddressBookFlag() == 1){
|
||||
//新增发货地址簿
|
||||
if (commonRouteDto.getSendAddressId() == null || commonRouteDto.getSendAddressId() == 0L){
|
||||
AddressBook addressBook1 = packAddressBookAndAdd(commonRouteDto, 1);
|
||||
commonRouteDto.setSendAddressId(addressBook1.getAddressBookId());
|
||||
}else {
|
||||
AddressBook addressBook1 = packAddressBookAndUpdate(commonRouteDto, 1);
|
||||
commonRouteDto.setSendAddressId(addressBook1.getAddressBookId());
|
||||
}
|
||||
|
||||
//新增卸货地址簿
|
||||
if (commonRouteDto.getReceiveAddressId() == null || commonRouteDto.getReceiveAddressId() == 0L){
|
||||
AddressBook addressBook1 = packAddressBookAndAdd(commonRouteDto, 2);
|
||||
commonRouteDto.setReceiveAddressId(addressBook1.getAddressBookId());
|
||||
}else {
|
||||
AddressBook addressBook1 = packAddressBookAndUpdate(commonRouteDto, 2);
|
||||
commonRouteDto.setReceiveAddressId(addressBook1.getAddressBookId());
|
||||
}
|
||||
}
|
||||
CommonRoute commonRoute = new AddressBookAssembler().toDo(commonRouteDto);
|
||||
commonRoute.setCreateBy(loginUser.getUserid());
|
||||
commonRoute.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
commonRoute.setCreateTime(new Date());
|
||||
commonRouteDomainService.insertCommonRoute(commonRoute);
|
||||
}else {
|
||||
if (commonRouteDto.getAddAddressBookFlag() == null || commonRouteDto.getAddAddressBookFlag() == 1){
|
||||
//新增发货地址簿
|
||||
if (commonRouteDto.getSendAddressId() == null || commonRouteDto.getSendAddressId() == 0L){
|
||||
AddressBook addressBook1 = packAddressBookAndAdd(commonRouteDto, 1);
|
||||
commonRouteDto.setSendAddressId(addressBook1.getAddressBookId());
|
||||
}else {
|
||||
AddressBook addressBook1 = packAddressBookAndUpdate(commonRouteDto, 1);
|
||||
commonRouteDto.setSendAddressId(addressBook1.getAddressBookId());
|
||||
}
|
||||
|
||||
//新增卸货地址簿
|
||||
if (commonRouteDto.getReceiveAddressId() == null || commonRouteDto.getReceiveAddressId() == 0L){
|
||||
AddressBook addressBook1 = packAddressBookAndAdd(commonRouteDto, 2);
|
||||
commonRouteDto.setReceiveAddressId(addressBook1.getAddressBookId());
|
||||
}else {
|
||||
AddressBook addressBook1 = packAddressBookAndUpdate(commonRouteDto, 2);
|
||||
commonRouteDto.setReceiveAddressId(addressBook1.getAddressBookId());
|
||||
}
|
||||
}
|
||||
CommonRoute commonRoute = new AddressBookAssembler().toDo(commonRouteDto);
|
||||
commonRoute.setUpdateBy(loginUser.getUserid());
|
||||
commonRoute.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
commonRoute.setUpdateTime(new Date());
|
||||
commonRouteDomainService.updateCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装并保存
|
||||
* @param commonRouteDto 线路
|
||||
* @param type 封装类型 1-发货,2-收货
|
||||
* @return
|
||||
*/
|
||||
public AddressBook packAddressBookAndAdd(CommonRouteDto commonRouteDto, Integer type){
|
||||
// 获取登录人id
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AddressBook addressBook = new AddressBook();
|
||||
Long addresseeCountyCode;
|
||||
String addresseeAddress;
|
||||
String addresseeName;
|
||||
String addresseePhone;
|
||||
String longitude;
|
||||
String latitude;
|
||||
String unitName;
|
||||
if (type == 1){
|
||||
addresseeCountyCode = commonRouteDto.getMailCountyCode();
|
||||
addresseeAddress = commonRouteDto.getMailAddress();
|
||||
addresseeName = commonRouteDto.getMailName();
|
||||
addresseePhone = commonRouteDto.getMailPhone();
|
||||
longitude = commonRouteDto.getSendLongitude();
|
||||
latitude = commonRouteDto.getSendLatitude();
|
||||
unitName = commonRouteDto.getSendUnitName();
|
||||
}else {
|
||||
addresseeCountyCode = commonRouteDto.getAddresseeCountyCode();
|
||||
addresseeAddress = commonRouteDto.getAddresseeAddress();
|
||||
addresseeName = commonRouteDto.getAddresseeName();
|
||||
addresseePhone = commonRouteDto.getAddresseePhone();
|
||||
longitude = commonRouteDto.getReceiveLongitude();
|
||||
latitude = commonRouteDto.getReceiveLatitude();
|
||||
unitName = commonRouteDto.getReceiveLatitude();
|
||||
}
|
||||
//查询是否有已存在的数据
|
||||
AddressBook addressBook1 = addressBookDomainService.selectOneByLambda(new LambdaQueryWrapper<AddressBook>()
|
||||
.eq(AddressBook::getCountyCode, addresseeCountyCode)
|
||||
.eq(AddressBook::getAddress, addresseeAddress)
|
||||
.eq(AddressBook::getLinkMan, addresseeName)
|
||||
.eq(AddressBook::getLinkPhone, addresseePhone)
|
||||
.eq(AddressBook::getDelFlag, 1)
|
||||
.last("limit 1"));
|
||||
//不存在的时候进行封装保存
|
||||
if (addressBook1 == null){
|
||||
addressBook.setCreateBy(loginUser.getUserid());
|
||||
addressBook.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
addressBook.setCreateTime(new Date());
|
||||
addressBook.setCountyCode(addresseeCountyCode);
|
||||
addressBook.setCountyName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBook.setAddress(addresseeAddress);
|
||||
addressBook.setLinkMan(addresseeName);
|
||||
addressBook.setLinkPhone(addresseePhone);
|
||||
addressBook.setLongitude(longitude);
|
||||
addressBook.setLatitude(latitude);
|
||||
addressBook.setUnitName(unitName);
|
||||
addressBook.setDelFlag(1);
|
||||
addressBook.setUserId(commonRouteDto.getUserId());
|
||||
addressBook.setAreaName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBookDomainService.insertAddressBook(addressBook);
|
||||
}else {
|
||||
addressBook = addressBook1;
|
||||
}
|
||||
return addressBook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装并更新
|
||||
* @param commonRouteDto 线路
|
||||
* @param type 封装类型 1-发货,2-收货
|
||||
* @return
|
||||
*/
|
||||
public AddressBook packAddressBookAndUpdate(CommonRouteDto commonRouteDto, Integer type){
|
||||
// 获取登录人id
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AddressBook addressBook = new AddressBook();
|
||||
Long addresseeCountyCode;
|
||||
String addresseeAddress;
|
||||
String addresseeName;
|
||||
String addresseePhone;
|
||||
String longitude;
|
||||
String latitude;
|
||||
Long addressBoodId;
|
||||
if (type == 1){
|
||||
addresseeCountyCode = commonRouteDto.getMailCountyCode();
|
||||
addresseeAddress = commonRouteDto.getMailAddress();
|
||||
addresseeName = commonRouteDto.getMailName();
|
||||
addresseePhone = commonRouteDto.getMailPhone();
|
||||
longitude = commonRouteDto.getSendLongitude();
|
||||
latitude = commonRouteDto.getSendLatitude();
|
||||
addressBoodId = commonRouteDto.getSendAddressId();
|
||||
}else {
|
||||
addresseeCountyCode = commonRouteDto.getAddresseeCountyCode();
|
||||
addresseeAddress = commonRouteDto.getAddresseeAddress();
|
||||
addresseeName = commonRouteDto.getAddresseeName();
|
||||
addresseePhone = commonRouteDto.getAddresseePhone();
|
||||
longitude = commonRouteDto.getReceiveLongitude();
|
||||
latitude = commonRouteDto.getReceiveLatitude();
|
||||
addressBoodId = commonRouteDto.getReceiveAddressId();
|
||||
}
|
||||
//查询是否有已存在的数据
|
||||
AddressBook addressBook1 = addressBookDomainService.selectOneByLambda(new LambdaQueryWrapper<AddressBook>()
|
||||
.eq(AddressBook::getAddressBookId, addressBoodId)
|
||||
.eq(AddressBook::getDelFlag, 1)
|
||||
.last("limit 1"));
|
||||
//不存在的时候进行封装保存
|
||||
if (addressBook1 == null){
|
||||
addressBook.setCreateBy(loginUser.getUserid());
|
||||
addressBook.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
addressBook.setCreateTime(new Date());
|
||||
addressBook.setCountyCode(addresseeCountyCode);
|
||||
addressBook.setCountyName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBook.setAddress(addresseeAddress);
|
||||
addressBook.setLinkMan(addresseeName);
|
||||
addressBook.setLinkPhone(addresseePhone);
|
||||
addressBook.setLongitude(longitude);
|
||||
addressBook.setLatitude(latitude);
|
||||
addressBook.setDelFlag(1);
|
||||
addressBook.setUserId(commonRouteDto.getUserId());
|
||||
addressBook.setAreaName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBookDomainService.insertAddressBook(addressBook);
|
||||
}else {
|
||||
addressBook = addressBook1;
|
||||
addressBook.setUpdateBy(loginUser.getUserid());
|
||||
addressBook.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
addressBook.setUpdateTime(new Date());
|
||||
addressBook.setCountyCode(addresseeCountyCode);
|
||||
addressBook.setCountyName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBook.setAddress(addresseeAddress);
|
||||
addressBook.setLinkMan(addresseeName);
|
||||
addressBook.setLinkPhone(addresseePhone);
|
||||
addressBook.setLongitude(longitude);
|
||||
addressBook.setLatitude(latitude);
|
||||
addressBook.setDelFlag(1);
|
||||
addressBook.setUserId(commonRouteDto.getUserId());
|
||||
addressBook.setAreaName(commonRouteDto.getAddresseeCountyName());
|
||||
addressBookDomainService.updateAddressBook(addressBook);
|
||||
}
|
||||
return addressBook;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算网点距离(直线距离)
|
||||
*/
|
||||
private BigDecimal calculateDistance(String lonA, String latA, String lonB, String latB){
|
||||
return DistanceUtil.getDistanceBigDecimalOneDecimalPlace(latA,lonA,latB,lonB);
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.mhd.basic.application.service.associationWarehouse;
|
||||
|
||||
import com.mhd.basic.domain.warehouse.repository.po.WarehousePO;
|
||||
import com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO;
|
||||
import com.mhd.basic.domain.warehouse.service.WarehouseDomainService;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.po.AssociationWarehousePO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
import com.mhd.basic.domain.associationWarehouse.service.AssociationWarehouseDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 关联仓库ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AssociationWarehouseApplicationService {
|
||||
@Autowired
|
||||
private AssociationWarehouseDomainService associationWarehouseDomainService;
|
||||
@Autowired
|
||||
private WarehouseDomainService warehouseDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询关联仓库列表
|
||||
*/
|
||||
|
||||
public List<AssociationWarehousePO> queryList(AssociationWarehouseDO associationWarehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser.getUserPo().getRoleCode().equals(RoleEnum.SUPER_ADMIN.getCode()) || loginUser.getUserPo().getRoleCode().equals(RoleEnum.PLAT_ADMIN.getCode())){
|
||||
WarehouseDO warehouseDO = new WarehouseDO();
|
||||
if (loginUser.getUserPo().getRoleCode().equals(RoleEnum.PLAT_ADMIN.getCode())){
|
||||
warehouseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
List<WarehousePO> warehousePOList = warehouseDomainService.queryList(warehouseDO);
|
||||
List<AssociationWarehousePO> associationWarehousePOList = new ArrayList<>();
|
||||
warehousePOList.forEach(warehousePO -> {
|
||||
AssociationWarehousePO associationWarehousePO = new AssociationWarehousePO();
|
||||
associationWarehousePO.setWarehouseId(warehousePO.getWarehouseId());
|
||||
associationWarehousePO.setWarehouseCode(warehousePO.getWarehouseCode());
|
||||
associationWarehousePO.setWarehouseName(warehousePO.getWarehouseName());
|
||||
associationWarehousePO.setOrganizationId(warehousePO.getOrganizationId());
|
||||
associationWarehousePO.setOrganizationName(warehousePO.getOrganizationName());
|
||||
associationWarehousePO.setTopOrganizationId(warehousePO.getTopOrganizationId());
|
||||
associationWarehousePOList.add(associationWarehousePO);
|
||||
});
|
||||
return associationWarehousePOList;
|
||||
}else {
|
||||
associationWarehouseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
associationWarehouseDO.setCorrelationId(loginUser.getUserid());
|
||||
return associationWarehouseDomainService.queryList(associationWarehouseDO);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> queryListCorrelationId(AssociationWarehouseDO associationWarehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
associationWarehouseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
List<AssociationWarehousePO> associationWarehousePOList = associationWarehouseDomainService.queryList(associationWarehouseDO);
|
||||
return associationWarehousePOList.stream()
|
||||
.map(AssociationWarehousePO::getCorrelationId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增关联仓库
|
||||
*/
|
||||
public Boolean associationWarehouse(AssociationWarehouseDO associationWarehouseDO) {
|
||||
return associationWarehouseDomainService.associationWarehouse(associationWarehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除关联仓库
|
||||
*/
|
||||
public boolean delete(Long[] associationWarehouseIds) {
|
||||
return associationWarehouseDomainService.delete(associationWarehouseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联仓库详细信息
|
||||
*/
|
||||
public AssociationWarehousePO getInfo(Long associationWarehouseId)
|
||||
{
|
||||
return associationWarehouseDomainService.getInfo(associationWarehouseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 切换仓库
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/11 15:34
|
||||
* @param associationWarehouseDO
|
||||
* @return List<AssociationWarehousePO>
|
||||
*/
|
||||
public AssociationWarehouseCacheDO setWarehouseInfo(AssociationWarehouseDO associationWarehouseDO) {
|
||||
return associationWarehouseDomainService.setWarehouseInfo(associationWarehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询关联仓库列表根据关联id
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/11 15:34
|
||||
* @param correlationId
|
||||
* @return List<AssociationWarehousePO>
|
||||
*/
|
||||
public AssociationWarehouseCacheDO getWarehouseInfo(Long correlationId) {
|
||||
return associationWarehouseDomainService.getWarehouseInfo(correlationId);
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.mhd.basic.application.service.batch;
|
||||
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.batch.service.BatchDomainService;
|
||||
import com.mhd.basic.domain.pack.repository.todo.PackDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 批次管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BatchApplicationService {
|
||||
@Autowired
|
||||
private BatchDomainService batchDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询批次管理列表
|
||||
*/
|
||||
|
||||
public List<BatchPO> queryList(BatchDO batchDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
batchDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return batchDomainService.queryList(batchDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增批次管理
|
||||
*/
|
||||
public Boolean insert(BatchDO batchDO) {
|
||||
return batchDomainService.insert(batchDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理
|
||||
*/
|
||||
public Boolean update(BatchDO batchDO) {
|
||||
return batchDomainService.update(batchDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理
|
||||
*/
|
||||
public boolean delete(Long[] batchIds) {
|
||||
return batchDomainService.delete(batchIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次管理详细信息
|
||||
*/
|
||||
public BatchPO getInfo(Long batchId)
|
||||
{
|
||||
return batchDomainService.getInfo(batchId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据id作废批次
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 15:28
|
||||
* @param batchId
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] batchId){
|
||||
return batchDomainService.nullifyByIds(batchId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 设置组织信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 8:56
|
||||
* @param batchDO
|
||||
*/
|
||||
private void setOrganizationParams(BatchDO batchDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
batchDO.setOrganizationId(userPo.getOrganizationId());
|
||||
batchDO.setOrganizationName(userPo.getOrganizationName());
|
||||
batchDO.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.mhd.basic.application.service.batchDetail;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import com.mhd.basic.domain.batchDetail.service.BatchDetailDomainService;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.MaterialGoodsRuleFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 批次管理详情ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BatchDetailApplicationService {
|
||||
@Autowired
|
||||
private BatchDetailDomainService batchDetailDomainService;
|
||||
@Autowired
|
||||
private WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询批次管理详情列表
|
||||
*/
|
||||
|
||||
public List<BatchDetailPO> queryList(BatchDetailDO batchDetailDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
batchDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return batchDetailDomainService.queryList(batchDetailDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增批次管理详情
|
||||
*/
|
||||
public Boolean insert(BatchDetailDO batchDetailDO) {
|
||||
|
||||
return batchDetailDomainService.insert(batchDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理详情
|
||||
*/
|
||||
public Boolean update(BatchDetailDO batchDetailDO) {
|
||||
return batchDetailDomainService.update(batchDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理详情
|
||||
*/
|
||||
public boolean delete(Long[] batchDetailIds) {
|
||||
return batchDetailDomainService.delete(batchDetailIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次管理详情详细信息
|
||||
*/
|
||||
public BatchDetailPO getInfo(Long batchDetailId)
|
||||
{
|
||||
return batchDetailDomainService.getInfo(batchDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次管理详情详细信息
|
||||
*/
|
||||
public List<BatchDetailPO> getBatchDetailListByBatchId(Long batchId)
|
||||
{
|
||||
return batchDetailDomainService.getBatchDetailListByBatchId(batchId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 根据物料基础信息id 获取批次管理详情
|
||||
* @author ZhouGY
|
||||
* @date 2024/7/21 16:10
|
||||
* @param materialBaseInfoId
|
||||
* @return List<BatchDetailPO>
|
||||
*/
|
||||
public List<BatchDetailPO> getBatchDetailListByMaterialBaseInfoId(Long materialBaseInfoId) {
|
||||
//获取商品规则详情
|
||||
AjaxResult ajaxResult = wmsServiceFeign.getInfoByMaterialBaseInfoIds(materialBaseInfoId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取物料规则信息失败");
|
||||
}
|
||||
MaterialGoodsRuleFeign materialGoodsRuleFeign = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), MaterialGoodsRuleFeign.class);
|
||||
if (ObjectUtil.isNull(materialGoodsRuleFeign)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return getBatchDetailListByBatchId(materialGoodsRuleFeign.getBatchId());
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package com.mhd.basic.application.service.brand;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.brand.repository.po.BrandPO;
|
||||
import com.mhd.basic.domain.brand.repository.todo.BrandDO;
|
||||
import com.mhd.basic.domain.brand.service.BrandDomainService;
|
||||
import com.mhd.basic.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 品牌管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BrandApplicationService {
|
||||
@Autowired
|
||||
private BrandDomainService brandDomainService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询品牌管理列表
|
||||
*/
|
||||
|
||||
public List<BrandPO> queryList(BrandDO brandDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
brandDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return brandDomainService.queryList(brandDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*/
|
||||
public Boolean insert(BrandDO brandDO) {
|
||||
//设置组织信息
|
||||
setOrganizationParams(brandDO);
|
||||
//设置货主信息
|
||||
shipperParam(brandDO);
|
||||
return brandDomainService.insert(brandDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*/
|
||||
public Boolean update(BrandDO brandDO) {
|
||||
return brandDomainService.update(brandDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除品牌管理
|
||||
*/
|
||||
public boolean delete(Long[] brandIds) {
|
||||
return brandDomainService.delete(brandIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌管理详细信息
|
||||
*/
|
||||
public BrandPO getInfo(Long brandId)
|
||||
{
|
||||
return brandDomainService.getInfo(brandId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据id作废品牌
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 15:29
|
||||
* @param brandIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] brandIds) {
|
||||
return brandDomainService.nullifyByIds(brandIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 封装货主信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/9 20:43
|
||||
* @param brandDO
|
||||
*/
|
||||
private void shipperParam(BrandDO brandDO){
|
||||
AjaxResult ajaxResult = userServiceFeign.getInfo(brandDO.getShipperId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取货主信息失败");
|
||||
}
|
||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
brandDO.setShipperName(userPo.getUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置组织信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 8:56
|
||||
* @param brandDO
|
||||
*/
|
||||
private void setOrganizationParams(BrandDO brandDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
brandDO.setOrganizationId(userPo.getOrganizationId());
|
||||
brandDO.setOrganizationName(userPo.getOrganizationName());
|
||||
brandDO.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.mhd.basic.application.service.common;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.basic.infrastructure.feign.UserServiceFeign;
|
||||
import com.mhd.basic.domain.common.entity.DataPermission;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.po.UserDataPermissionPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公共 应用服务层
|
||||
* <p>
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
* <p>
|
||||
* 2023-02-20
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonApplicationService {
|
||||
|
||||
@Resource
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
/**
|
||||
* 判断当前登录人的数据权限
|
||||
*
|
||||
*/
|
||||
public DataPermission dataPermission(Long permissionMenuId) {
|
||||
DataPermission dataPermission = new DataPermission();
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// LoginUser loginUser = new LoginUser();
|
||||
// Long userId = new Long("19");
|
||||
// Long organizationId = new Long("1");
|
||||
// if(1 == 1){
|
||||
if(loginUser.getUserPo() != null){
|
||||
Long userId = loginUser.getUserid();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
UserPo userpo = new UserPo();
|
||||
userpo.setRoleCode("plat_admin");
|
||||
loginUser.setUserPo(userpo);
|
||||
//判断当前用户是否是超级管理员/租户管理员还是普通用户,如果是超级管理员则返回全部组织,租户管理员则返回租户所属组织的全部组织,普通用户需要判断数据权限
|
||||
if(RoleEnum.SUPER_ADMIN.getCode().equals(loginUser.getUserPo().getRoleCode())){
|
||||
//全部不加限制条件
|
||||
}else if(RoleEnum.PLAT_ADMIN.getCode().equals(loginUser.getUserPo().getRoleCode())) {
|
||||
//获取当前组织全部下级组织id
|
||||
AjaxResult ajaxResult = productServiceFeign.getOrganizationIdsByOrganizationId(organizationId);
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
List<Long> longs = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), Long.class);
|
||||
dataPermission.setOrganizationIdList(longs);
|
||||
}
|
||||
}else {
|
||||
//获取当前用户数据权限
|
||||
UserDataPermissionQueryDTO userDataPermissionQueryDTO = new UserDataPermissionQueryDTO();
|
||||
userDataPermissionQueryDTO.setMenuId(permissionMenuId);
|
||||
userDataPermissionQueryDTO.setOrganizationId(organizationId);
|
||||
userDataPermissionQueryDTO.setUserId(userId);
|
||||
AjaxResult info = userServiceFeign.findUserDataPermission(userDataPermissionQueryDTO);
|
||||
if("200".equals(String.valueOf(info.get("code")))){
|
||||
UserDataPermissionPO userDataPermissionPO = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")), UserDataPermissionPO.class);
|
||||
if(userDataPermissionPO.getUserDataOrganizationStatus() != null){
|
||||
//1表示可以查询当前组织及下级组织的数据,反之只能看到自己创建的数据
|
||||
if(userDataPermissionPO.getUserDataOrganizationStatus() == 1){
|
||||
Long topOrganizationId = new Long("1");
|
||||
//获取当前组织最上级
|
||||
AjaxResult topId = productServiceFeign.selectTopId(organizationId);
|
||||
if("200".equals(String.valueOf(topId.get("code")))){
|
||||
topOrganizationId = JSONObject.parseObject(JSONObject.toJSONString(topId.get("data")), Long.class);
|
||||
}
|
||||
//获取当前组织全部下级组织id
|
||||
AjaxResult ajaxResult = productServiceFeign.getOrganizationIdsByOrganizationId(topOrganizationId);
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
List<Long> longs = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), Long.class);
|
||||
dataPermission.setOrganizationIdList(longs);
|
||||
}
|
||||
}else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
}else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataPermission;
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.mhd.basic.application.service.commonLineDriver;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.commonLineDriver.repository.po.CommonLineDriverPO;
|
||||
import com.mhd.basic.domain.commonLineDriver.repository.todo.CommonLineDriverDO;
|
||||
import com.mhd.basic.domain.commonLineDriver.service.CommonLineDriverDomainService;
|
||||
import com.mhd.basic.interfaces.dto.commonLineDriver.CommonLineDriverDTO;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机常跑线路ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-19
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonLineDriverApplicationService {
|
||||
@Autowired
|
||||
private CommonLineDriverDomainService commonLineDriverDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询司机常跑线路列表
|
||||
*/
|
||||
|
||||
public List<CommonLineDriverPO> queryList(CommonLineDriverDO commonLineDriverDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
commonLineDriverDO.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
return commonLineDriverDomainService.queryList(commonLineDriverDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增司机常跑线路
|
||||
*/
|
||||
public Boolean insert(CommonLineDriverDO commonLineDriverDO) {
|
||||
|
||||
return commonLineDriverDomainService.insert(commonLineDriverDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机常跑线路
|
||||
*/
|
||||
public Boolean update(CommonLineDriverDO commonLineDriverDO) {
|
||||
return commonLineDriverDomainService.update(commonLineDriverDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除司机常跑线路
|
||||
*/
|
||||
public boolean delete(CommonLineDriverDTO commonLineDriverDTO) {
|
||||
String commonLineDriverIds = commonLineDriverDTO.getCommonLineDriverIds();
|
||||
List<Long> ids = Convert.toList(Long.class, commonLineDriverIds);
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
throw new RuntimeException("请选择要删除的常跑线路");
|
||||
}
|
||||
return commonLineDriverDomainService.delete(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机常跑线路详细信息
|
||||
*/
|
||||
public CommonLineDriverPO getInfo(CommonLineDriverDTO commonLineDriverDTO) {
|
||||
Long commonLineDriverId = commonLineDriverDTO.getCommonLineDriverId();
|
||||
if (ObjectUtil.isNull(commonLineDriverId)) {
|
||||
throw new RuntimeException("请选择要查看的常跑线路");
|
||||
}
|
||||
return commonLineDriverDomainService.getInfo(commonLineDriverId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.mhd.basic.application.service.container;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
||||
import com.mhd.basic.domain.container.service.ContainerDomainService;
|
||||
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 容器管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ContainerApplicationService {
|
||||
@Autowired
|
||||
private ContainerDomainService containerDomainService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询容器管理列表
|
||||
*/
|
||||
|
||||
public List<ContainerPO> queryList(ContainerDO containerDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
containerDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return containerDomainService.queryList(containerDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增容器管理
|
||||
*/
|
||||
public Boolean insert(ContainerDO containerDO) {
|
||||
//翻译库区类型
|
||||
setDataDict(containerDO);
|
||||
return containerDomainService.insert(containerDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器管理
|
||||
*/
|
||||
public Boolean update(ContainerDO containerDO) {
|
||||
return containerDomainService.update(containerDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除容器管理
|
||||
*/
|
||||
public boolean delete(Long[] containerIds) {
|
||||
return containerDomainService.delete(containerIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取容器管理详细信息
|
||||
*/
|
||||
public ContainerPO getInfo(Long containerId)
|
||||
{
|
||||
return containerDomainService.getInfo(containerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量作废容器
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 9:46
|
||||
* @param containerIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(List<Long> containerIds){
|
||||
return containerDomainService.nullifyByIds(containerIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置数据字典键值
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 14:33
|
||||
* @param containerDO
|
||||
*/
|
||||
private void setDataDict(ContainerDO containerDO){
|
||||
//翻译容器类型
|
||||
List<SysDictData> storageTypeDictDataList = dictTypeService.selectDictDataByType(DictCode.CONTAINER_TYPE.getCode());
|
||||
if (null == storageTypeDictDataList) {
|
||||
throw new ServiceException("容器类型数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData storageTypeDictData = storageTypeDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), containerDO.getContainerType())).findAny().orElse(null);
|
||||
if (null == storageTypeDictData) {
|
||||
throw new ServiceException("容器类型【" + containerDO.getContainerType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
containerDO.setContainerTypeName(storageTypeDictData.getDictLabel());
|
||||
}
|
||||
}
|
||||
+389
@@ -0,0 +1,389 @@
|
||||
package com.mhd.basic.application.service.contractManage;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
|
||||
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
|
||||
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
|
||||
import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
|
||||
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.ContractManageDTO;
|
||||
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
|
||||
import com.mhd.common.core.domain.po.BillingRulesPO;
|
||||
import com.mhd.common.core.domain.po.DocumentTypePO;
|
||||
import com.mhd.common.core.domain.po.SettlementCustomersPO;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.BmsServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 合同管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ContractManageApplicationService {
|
||||
@Autowired
|
||||
private ContractManageDomainService contractManageDomainService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private ExpenseAccountDomainService expenseAccountDomainService;
|
||||
@Autowired
|
||||
private ContractManageDetailDomainService contractManageDetailDomainService;
|
||||
@Autowired
|
||||
private BmsServiceFeign bmsServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询合同管理列表
|
||||
*/
|
||||
|
||||
public List<ContractManagePO> queryList(ContractManageDO contractManageDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
contractManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return contractManageDomainService.queryList(contractManageDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增合同管理
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean insert(ContractManageDO contractManageDO) {
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
/*
|
||||
通用合同:同一时间段、同一合同类型,只能存在一个
|
||||
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
|
||||
*/
|
||||
checkContract(contractManageDO);
|
||||
handleData(contractManageDO);
|
||||
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
|
||||
contractManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
boolean flag = contractManageDomainService.insert(contractManageDO);
|
||||
handleDetils(contractManageDO);
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*/
|
||||
private void handleData(ContractManageDO contractManageDO) {
|
||||
//根据合同生效时间判断合同是否生效
|
||||
if (DateUtil.compare(contractManageDO.getEffectiveDate(), new Date()) > 0) {
|
||||
contractManageDO.setContractState(2);
|
||||
} else {
|
||||
contractManageDO.setContractState(1);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(contractManageDO.getSettlementCustomersCode())){
|
||||
AjaxResult ajaxResult = bmsServiceFeign.getCustomersInfoByCode(contractManageDO.getSettlementCustomersCode());
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取结算客户信息失败");
|
||||
}
|
||||
SettlementCustomersPO settlementCustomersPO = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), SettlementCustomersPO.class);
|
||||
if(null == settlementCustomersPO){
|
||||
throw new ServiceException("结算客户信息未找到");
|
||||
}
|
||||
contractManageDO.setSettlementCustomers(settlementCustomersPO.getSettlementEntity());
|
||||
contractManageDO.setSettlementCustomersId(settlementCustomersPO.getSettlementCustomersId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验合同是否合法
|
||||
* @param contractManageDO
|
||||
*/
|
||||
private void checkContract(ContractManageDO contractManageDO) {
|
||||
ContractManageDO commonQueryParam = new ContractManageDO();
|
||||
commonQueryParam.setContractType(contractManageDO.getContractType());
|
||||
commonQueryParam.setSettlementCustomersCode(contractManageDO.getSettlementCustomersCode());
|
||||
commonQueryParam.setEffectiveDateString(DateUtil.format(contractManageDO.getEffectiveDate(),"yyyy-MM-dd"));
|
||||
commonQueryParam.setExpirationDateString(DateUtil.format(contractManageDO.getExpirationDate(),"yyyy-MM-dd"));
|
||||
//通用合同
|
||||
if(contractManageDO.getCommonContractFlag()==1){
|
||||
commonQueryParam.setCommonContractFlag(1);
|
||||
List<ContractManagePO> contractManagePOS = contractManageDomainService.queryList(commonQueryParam);
|
||||
if(contractManageDO.getContractManageId() != null){
|
||||
//修改时需要过滤掉当前合同
|
||||
contractManagePOS = contractManagePOS.stream().filter(item -> !ObjectUtil.equal(item.getContractManageId(),contractManageDO.getContractManageId())).collect(Collectors.toList());
|
||||
}
|
||||
if (contractManagePOS.size() > 0) {
|
||||
throw new ServiceException("有效期内含有其他通用合同,不可重复新增");
|
||||
}
|
||||
}
|
||||
//特殊合同
|
||||
else {
|
||||
commonQueryParam.setCommonContractFlag(2);
|
||||
List<ContractManagePO> contractManagePOS = contractManageDomainService.queryList(commonQueryParam);
|
||||
if(contractManageDO.getContractManageId() != null){
|
||||
//修改时需要过滤掉当前合同
|
||||
contractManagePOS = contractManagePOS.stream().filter(item -> !ObjectUtil.equal(item.getContractManageId(),contractManageDO.getContractManageId())).collect(Collectors.toList());
|
||||
}
|
||||
if (contractManagePOS.size() > 0) {
|
||||
throw new ServiceException("有效期内含有其他特殊合同,不可重复新增");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理合同详情
|
||||
*/
|
||||
private void handleDetils(ContractManageDO contractManageDO) {
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据合同编码查询保存合同信息
|
||||
ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode(contractManageDO.getContractNumber());
|
||||
//保存合同详情科目
|
||||
List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList();
|
||||
if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){
|
||||
//查询费用科目、计费周期数据字典
|
||||
List<SysDictData> billingAttributesList = dictTypeService.selectDictDataByType(DictCode.BILLING_ATTRIBUTES.getCode());
|
||||
for (ContractManageDetailDTO contractManageDetailDTO : contractManageDetailDTOList) {
|
||||
ContractManageDetailDO contractManageDetailDO = new ContractManageDetailDO();
|
||||
BeanUtils.copyProperties(contractManageDetailDTO,contractManageDetailDO);
|
||||
//根据费用科目查询费用信息
|
||||
if(StringUtils.isNotEmpty(contractManageDetailDTO.getSecondSubjectCode())){
|
||||
ExpenseAccountPO expenseAccountPO = expenseAccountDomainService.getInfoByCode(contractManageDetailDTO.getSecondSubjectCode());
|
||||
if(expenseAccountPO != null){
|
||||
if(expenseAccountPO.getFirstSubjectFlag()==1){
|
||||
//如果是一级科目
|
||||
contractManageDetailDO.setFirstSubjectName(expenseAccountPO.getSubjectName());
|
||||
contractManageDetailDO.setFirstSubjectCode(expenseAccountPO.getSubjectCode());
|
||||
contractManageDetailDO.setSecondSubjectCode("");
|
||||
}else {
|
||||
//不是一级科目
|
||||
contractManageDetailDO.setFirstSubjectName(expenseAccountPO.getUpperSubject());
|
||||
contractManageDetailDO.setFirstSubjectCode(expenseAccountPO.getUpperSubjectCode());
|
||||
contractManageDetailDO.setSecondSubjectCode(expenseAccountPO.getSubjectCode());
|
||||
contractManageDetailDO.setSecondSubjectName(expenseAccountPO.getSubjectName());
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理计费周期数据字典
|
||||
if (billingAttributesList != null && billingAttributesList.size() > 0){
|
||||
for (SysDictData sysDictData : billingAttributesList) {
|
||||
if (contractManageDetailDO.getBillingAttributesCode().equals(sysDictData.getDictValue())){
|
||||
contractManageDetailDO.setBillingAttributes(sysDictData.getDictLabel());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理计费策略
|
||||
if(StringUtils.isNotEmpty(contractManageDetailDTO.getAccountingStrategyCode())){
|
||||
AjaxResult ajaxResult = bmsServiceFeign.getInfoByCode(contractManageDetailDTO.getAccountingStrategyCode());
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("费用科目"+ contractManageDetailDTO.getFirstSubjectName() + ",所选计费策略信息未找到");
|
||||
}
|
||||
BillingRulesPO billingRulesPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), BillingRulesPO.class);
|
||||
if(null == billingRulesPO){
|
||||
throw new ServiceException("费用科目"+ contractManageDetailDTO.getFirstSubjectName() + ",所选计费策略信息未找到");
|
||||
}
|
||||
contractManageDetailDO.setAccountingStrategy(billingRulesPO.getBillingRulesName());
|
||||
contractManageDetailDO.setAccountingStrategyCode(billingRulesPO.getBillingRulesCode());
|
||||
contractManageDetailDO.setAccountingStrategyId(billingRulesPO.getBillingRulesId());
|
||||
}
|
||||
//处理单据类型
|
||||
if(StringUtils.isNotEmpty(contractManageDetailDTO.getDocumentTypeCode())){
|
||||
Set<String> documentTypeCodeSet = Stream.of(contractManageDetailDTO.getDocumentTypeCode().split(",")).collect(Collectors.toSet());
|
||||
AjaxResult ajaxResult = bmsServiceFeign.getDocumentInfoByCodeSet(documentTypeCodeSet);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("费用科目"+ contractManageDetailDTO.getFirstSubjectName() + ",所选单据类型信息未找到");
|
||||
}
|
||||
List<DocumentTypePO> documentTypePOList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), DocumentTypePO.class);
|
||||
//拼接单据类型名称
|
||||
if(null != documentTypePOList && documentTypePOList.size()>0){
|
||||
StringBuilder documentTypeName = new StringBuilder();
|
||||
for (DocumentTypePO documentTypePO : documentTypePOList) {
|
||||
documentTypeName.append(documentTypePO.getDocumentType()).append(",");
|
||||
}
|
||||
contractManageDetailDO.setDocumentType(documentTypeName.substring(0,documentTypeName.toString().length()-1));
|
||||
}
|
||||
}
|
||||
|
||||
if(null != contractManagePO){
|
||||
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId());
|
||||
}
|
||||
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
contractManageDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
contractManageDetailDomainService.saveOrUpdate(contractManageDetailDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同管理
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean update(ContractManageDO contractManageDO) {
|
||||
checkContract(contractManageDO);
|
||||
handleData(contractManageDO);
|
||||
handleDetils(contractManageDO);
|
||||
return contractManageDomainService.update(contractManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同管理
|
||||
*/
|
||||
public boolean delete(ContractManageDTO contractManageDTO) {
|
||||
if(!StringUtils.isNotEmpty(contractManageDTO.getContractManageIds())){
|
||||
throw new ServiceException("合同管理id不能为空");
|
||||
}
|
||||
Set<String> idSet = Stream.of(contractManageDTO.getContractManageIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] contractManageIds = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return contractManageDomainService.delete(contractManageIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取合同管理详细信息
|
||||
*/
|
||||
public ContractManagePO getInfo(Long contractManageId)
|
||||
{
|
||||
ContractManagePO result = contractManageDomainService.getInfo(contractManageId);
|
||||
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(result.getContractManageId());
|
||||
result.setContractManageDetailPOList(contractManageDetailPOList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据结算主体获取合同信息
|
||||
* @param settlementCustomersCode 结算主体code
|
||||
* @param contractType 合同类型
|
||||
*/
|
||||
public ContractManagePO getInfoByCustomer(String settlementCustomersCode,Integer contractType) {
|
||||
/*
|
||||
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
|
||||
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
|
||||
*/
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if(contractType==null){
|
||||
throw new ServiceException("合同类型不能为空");
|
||||
}
|
||||
ContractManagePO resultContract = new ContractManagePO();
|
||||
//查询当前日期在有效期内的合同
|
||||
ContractManageDO queryParam = new ContractManageDO();
|
||||
queryParam.setNowDateString(DateUtil.format(new Date(),"yyyy-MM-dd"));
|
||||
queryParam.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
List<ContractManagePO> contractManagePOList = contractManageDomainService.queryList(queryParam);
|
||||
if(contractManagePOList != null && contractManagePOList.size()>0){
|
||||
if(StringUtils.isNotEmpty(settlementCustomersCode)){
|
||||
//根据结算对象,及合同的类型 查询对应合同信息
|
||||
ContractManagePO contractManagePO = contractManagePOList.stream()
|
||||
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
|
||||
if(null == contractManagePO){
|
||||
if(contractType==1){
|
||||
//仓储合同
|
||||
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==1).findFirst().orElse(null);
|
||||
}else{
|
||||
//运输合同
|
||||
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2).findFirst().orElse(null);
|
||||
}
|
||||
}else {
|
||||
resultContract = contractManagePO;
|
||||
}
|
||||
}else {
|
||||
if(contractType==1){
|
||||
//仓储合同
|
||||
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1).findFirst().orElse(null);
|
||||
}else{
|
||||
//运输合同
|
||||
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
if(null == resultContract){
|
||||
throw new ServiceException("找不到匹配的合同,请重试");
|
||||
}
|
||||
//得到合同后,查询合同明细
|
||||
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(resultContract.getContractManageId());
|
||||
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
|
||||
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
|
||||
//将临时合同中没有,但是通用合同中有的数据过滤出
|
||||
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().noneMatch(item1 -> item1.getFirstSubjectCode().equals(item.getFirstSubjectCode()) && item1.getSecondSubjectCode().equals(item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
|
||||
//首先根据结算科目类型将临时合同过滤出
|
||||
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
|
||||
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
|
||||
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
|
||||
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
|
||||
if(contractManageDetailPO.getFirstSubjectCode().equals(manageDetailPO.getFirstSubjectCode()) && contractManageDetailPO.getSecondSubjectCode().equals(manageDetailPO.getSecondSubjectCode())){
|
||||
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
|
||||
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime now = DateUtil.beginOfDay(DateUtil.date());
|
||||
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
|
||||
contractManageDetailSaveList.add(manageDetailPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultContract.setContractManageDetailPOList(contractManageDetailSaveList);
|
||||
}
|
||||
return resultContract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废合同
|
||||
* @param contractManageDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean nullify(ContractManageDTO contractManageDTO) {
|
||||
if(!StringUtils.isNotEmpty(contractManageDTO.getContractManageIds())){
|
||||
throw new ServiceException("合同管理id不能为空");
|
||||
}
|
||||
return contractManageDomainService.nullify(contractManageDTO);
|
||||
}
|
||||
|
||||
public ContractManagePO getInfoByCode(String contractNumber) {
|
||||
return contractManageDomainService.getInfoByCode(contractNumber);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.application.service.contractManageDetail;
|
||||
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
|
||||
import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 合同管理详情ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ContractManageDetailApplicationService {
|
||||
@Autowired
|
||||
private ContractManageDetailDomainService contractManageDetailDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询合同管理详情列表
|
||||
*/
|
||||
|
||||
public List<ContractManageDetailPO> queryList(ContractManageDetailDO contractManageDetailDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return contractManageDetailDomainService.queryList(contractManageDetailDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增合同管理详情
|
||||
*/
|
||||
public Boolean insert(ContractManageDetailDO contractManageDetailDO) {
|
||||
|
||||
return contractManageDetailDomainService.insert(contractManageDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同管理详情
|
||||
*/
|
||||
public Boolean update(ContractManageDetailDO contractManageDetailDO) {
|
||||
return contractManageDetailDomainService.update(contractManageDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同管理详情
|
||||
*/
|
||||
public boolean delete(Long[] contractManageDetailIds) {
|
||||
return contractManageDetailDomainService.delete(contractManageDetailIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合同管理详情详细信息
|
||||
*/
|
||||
public ContractManageDetailPO getInfo(Long contractManageDetailId)
|
||||
{
|
||||
return contractManageDetailDomainService.getInfo(contractManageDetailId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+300
@@ -0,0 +1,300 @@
|
||||
package com.mhd.basic.application.service.expenseAccount;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.expenseAccount.entity.ExpenseAccount;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.po.QueryExpenseAccountPO;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDoMap;
|
||||
import com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountDO;
|
||||
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.basic.interfaces.dto.expenseAccount.ExpenseAccountDTO;
|
||||
import com.mhd.basic.interfaces.dto.expenseAccount.SearchExpenseAccountDTO;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 费用科目ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExpenseAccountApplicationService {
|
||||
@Autowired
|
||||
private ExpenseAccountDomainService expenseAccountDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询费用科目列表
|
||||
*/
|
||||
|
||||
public List<ExpenseAccountPO> queryList(ExpenseAccountDO expenseAccountDO) {
|
||||
setTopOrganizationIdLogin(expenseAccountDO);
|
||||
return expenseAccountDomainService.queryList(expenseAccountDO);
|
||||
}
|
||||
|
||||
public List<ExpenseAccountPO> treeCostSubject(ExpenseAccountDO expenseAccountDO){
|
||||
setTopOrganizationIdLogin(expenseAccountDO);
|
||||
return expenseAccountDomainService.treeCostSubject(expenseAccountDO);
|
||||
}
|
||||
|
||||
public List<ExpenseAccountPO> subjectTreeCost(ExpenseAccountDO expenseAccountDO){
|
||||
setTopOrganizationIdLogin(expenseAccountDO);
|
||||
return expenseAccountDomainService.treeCostSubject(expenseAccountDO);
|
||||
}
|
||||
|
||||
|
||||
private void setTopOrganizationIdLogin(ExpenseAccountDO expenseAccountDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
expenseAccountDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增费用科目
|
||||
*/
|
||||
public Boolean insert(ExpenseAccountDO expenseAccountDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//处理数据字典
|
||||
handleDict(expenseAccountDO);
|
||||
//如果是上级编码则查询上级编码信息,如果没有上级科目,就代表是一级科目
|
||||
if(StringUtils.isNotEmpty(expenseAccountDO.getUpperSubjectCode())){
|
||||
ExpenseAccountPO expenseAccountPO = expenseAccountDomainService.getInfoByCode(expenseAccountDO.getUpperSubjectCode());
|
||||
if(null == expenseAccountPO){
|
||||
throw new ServiceException("上级科目信息未找到");
|
||||
}
|
||||
expenseAccountDO.setUpperSubject(expenseAccountPO.getSubjectName());
|
||||
expenseAccountDO.setFirstSubjectFlag(2);
|
||||
}
|
||||
expenseAccountDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
expenseAccountDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
expenseAccountDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
return expenseAccountDomainService.insert(expenseAccountDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改费用科目
|
||||
*/
|
||||
public Boolean update(ExpenseAccountDO expenseAccountDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//处理数据字典
|
||||
handleDict(expenseAccountDO);
|
||||
//如果是上级编码则查询上级编码信息
|
||||
if(expenseAccountDO.getFirstSubjectFlag()==2){
|
||||
if(!StringUtils.isNotEmpty(expenseAccountDO.getUpperSubjectCode())){
|
||||
throw new ServiceException("上级科目编码不能为空");
|
||||
}
|
||||
ExpenseAccountPO expenseAccountPO = expenseAccountDomainService.getInfoByCode(expenseAccountDO.getUpperSubjectCode());
|
||||
if(null != expenseAccountPO){
|
||||
expenseAccountDO.setUpperSubject(expenseAccountPO.getSubjectName());
|
||||
}
|
||||
}
|
||||
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析数据字典
|
||||
* @param expenseAccountDO
|
||||
*/
|
||||
private void handleDict(ExpenseAccountDO expenseAccountDO) {
|
||||
//查询来源模块数据字典
|
||||
if(StringUtils.isNotEmpty(expenseAccountDO.getBelongModuleCode())){
|
||||
List<SysDictDataVo> modulesTypeList = null;
|
||||
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.MODULES.getCode());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
modulesTypeList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
if (modulesTypeList != null && modulesTypeList.size() > 0){
|
||||
for (SysDictDataVo sysDictDataVo : modulesTypeList) {
|
||||
if (expenseAccountDO.getBelongModuleCode().equals(sysDictDataVo.getDictValue())){
|
||||
expenseAccountDO.setBelongModule(sysDictDataVo.getDictLabel());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(expenseAccountDO.getBillingAttributesCode())){
|
||||
//查询计费属性数据字典
|
||||
List<SysDictDataVo> billingAttributesList = null;
|
||||
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.BILLING_ATTRIBUTES.getCode());
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
billingAttributesList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
|
||||
}
|
||||
if (billingAttributesList != null && billingAttributesList.size() > 0){
|
||||
for (SysDictDataVo sysDictDataVo : billingAttributesList) {
|
||||
if (expenseAccountDO.getBillingAttributesCode().equals(sysDictDataVo.getDictValue())){
|
||||
expenseAccountDO.setBillingAttributes(sysDictDataVo.getDictLabel());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除费用科目
|
||||
*/
|
||||
public boolean delete(ExpenseAccountDTO expenseAccountDTO) {
|
||||
if(!StringUtils.isNotEmpty(expenseAccountDTO.getExpenseAccountIds())){
|
||||
throw new ServiceException("服务项管理id不能为空");
|
||||
}
|
||||
Set<String> idSet = Stream.of(expenseAccountDTO.getExpenseAccountIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] expenseAccountIds = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return expenseAccountDomainService.delete(expenseAccountIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取费用科目详细信息
|
||||
*/
|
||||
public ExpenseAccountPO getInfo(Long expenseAccountId)
|
||||
{
|
||||
return expenseAccountDomainService.getInfo(expenseAccountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param expenseAccountDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean changeStatus(ExpenseAccountDTO expenseAccountDTO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据id修改启用状态停用状态
|
||||
if(expenseAccountDTO.getExpenseAccountId() == null){
|
||||
throw new ServiceException("费用科目id不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getStatus() == null){
|
||||
throw new ServiceException("状态不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getStatus() != 1 && expenseAccountDTO.getStatus()!=2){
|
||||
throw new ServiceException("状态错误");
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
expenseAccountDO.setExpenseAccountId(expenseAccountDTO.getExpenseAccountId());
|
||||
expenseAccountDO.setStatus(expenseAccountDTO.getStatus());
|
||||
expenseAccountDO.setUpdateBy(loginUser.getUserid());
|
||||
expenseAccountDO.setUpdateTime(new Date());
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自有车辆显示设置:自有车辆固定显示(1-是,2-否)
|
||||
* @param expenseAccountDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean changeOwnStatus(ExpenseAccountDTO expenseAccountDTO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据id修改启用状态停用状态
|
||||
if(expenseAccountDTO.getExpenseAccountId() == null){
|
||||
throw new ServiceException("费用科目id不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getOwnStatus() == null){
|
||||
throw new ServiceException("状态不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getOwnStatus() != 1 && expenseAccountDTO.getOwnStatus()!=2){
|
||||
throw new ServiceException("状态错误");
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
expenseAccountDO.setExpenseAccountId(expenseAccountDTO.getExpenseAccountId());
|
||||
expenseAccountDO.setOwnStatus(expenseAccountDTO.getOwnStatus());
|
||||
expenseAccountDO.setUpdateBy(loginUser.getUserid());
|
||||
expenseAccountDO.setUpdateTime(new Date());
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自有车辆显示设置:社会车辆固定显示(1-是,2-否)
|
||||
* @param expenseAccountDTO
|
||||
* @return
|
||||
*/
|
||||
public boolean changeSocietyStatus(ExpenseAccountDTO expenseAccountDTO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//根据id修改启用状态停用状态
|
||||
if(expenseAccountDTO.getExpenseAccountId() == null){
|
||||
throw new ServiceException("费用科目id不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getSocietyStatus() == null){
|
||||
throw new ServiceException("状态不能为空");
|
||||
}
|
||||
if(expenseAccountDTO.getSocietyStatus() != 1 && expenseAccountDTO.getSocietyStatus()!=2){
|
||||
throw new ServiceException("状态错误");
|
||||
}
|
||||
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||
expenseAccountDO.setExpenseAccountId(expenseAccountDTO.getExpenseAccountId());
|
||||
expenseAccountDO.setSocietyStatus(expenseAccountDTO.getSocietyStatus());
|
||||
expenseAccountDO.setUpdateBy(loginUser.getUserid());
|
||||
expenseAccountDO.setUpdateTime(new Date());
|
||||
expenseAccountDO.setUpdateByName(loginUser.getUsername());
|
||||
return expenseAccountDomainService.update(expenseAccountDO);
|
||||
}
|
||||
/**
|
||||
* 根据编码查询费用科目信息
|
||||
*/
|
||||
public ExpenseAccountPO getInfoByCode(String subjectCode) {
|
||||
if(!StringUtils.isNotEmpty(subjectCode)){
|
||||
throw new ServiceException("费用科目编码不能为空");
|
||||
}
|
||||
return expenseAccountDomainService.getInfoByCode(subjectCode);
|
||||
}
|
||||
|
||||
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
||||
return expenseAccountDomainService.selectExpenseAccount(searchExpenseAccountDO);
|
||||
}
|
||||
|
||||
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
||||
return expenseAccountDomainService.selectOtherExpenseAccount(searchExpenseAccountDO);
|
||||
}
|
||||
|
||||
public List<QueryExpenseAccountPO> selectSocialVehicleExpenseAccount(){
|
||||
return expenseAccountDomainService.selectSocialVehicleExpenseAccount();
|
||||
}
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package com.mhd.basic.application.service.materialBaseInfo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO;
|
||||
import com.mhd.basic.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
|
||||
import com.mhd.basic.domain.materialBaseInfo.service.MaterialBaseInfoDomainService;
|
||||
import com.mhd.basic.interfaces.vo.MaterialStockInfoVo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 物料基础信息ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaterialBaseInfoApplicationService {
|
||||
@Autowired
|
||||
private MaterialBaseInfoDomainService materialBaseInfoDomainService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询物料基础信息列表
|
||||
*/
|
||||
|
||||
public List<MaterialBaseInfoPO> queryList(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
materialBaseInfoDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return materialBaseInfoDomainService.queryList(materialBaseInfoDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增物料基础信息
|
||||
*/
|
||||
public Boolean insert(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
//翻译物料信息数据字典
|
||||
translateDataDict(materialBaseInfoDO);
|
||||
//设置货主信息
|
||||
shipperParam(materialBaseInfoDO);
|
||||
return materialBaseInfoDomainService.insert(materialBaseInfoDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物料基础信息
|
||||
*/
|
||||
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
//翻译物料信息数据字典
|
||||
translateDataDict(materialBaseInfoDO);
|
||||
//设置货主信息
|
||||
shipperParam(materialBaseInfoDO);
|
||||
return materialBaseInfoDomainService.update(materialBaseInfoDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除物料基础信息
|
||||
*/
|
||||
public boolean delete(Long[] materialBaseInfoIds) {
|
||||
return materialBaseInfoDomainService.delete(materialBaseInfoIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物料基础信息详细信息
|
||||
*/
|
||||
public MaterialBaseInfoPO getInfo(Long materialBaseInfoId)
|
||||
{
|
||||
return materialBaseInfoDomainService.getInfo(materialBaseInfoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 数据字典翻译
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/9 19:53
|
||||
*/
|
||||
private void translateDataDict(MaterialBaseInfoDO materialBaseInfoDO){
|
||||
//翻译物料种类
|
||||
List<SysDictData> materialTypeList = dictTypeService.selectDictDataByType(DictCode.MATERIAL_TYPE.getCode());
|
||||
SysDictData materialType = materialTypeList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), materialBaseInfoDO.getMaterialType())).findAny().orElse(null);
|
||||
if (null == materialType) {
|
||||
throw new ServiceException("物料种类【" + materialBaseInfoDO.getMaterialClassifyCode() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
//物料种类名称 字典键值
|
||||
materialBaseInfoDO.setMaterialTypeName(materialType.getDictLabel());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 封装货主信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/9 20:43
|
||||
* @param materialBaseInfoDO
|
||||
*/
|
||||
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
|
||||
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取货主信息失败");
|
||||
}
|
||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
||||
}
|
||||
|
||||
public List<MaterialStockInfoVo> getMaterialStockList(String shipperName, String materialName,
|
||||
String machineCode, Integer pageNum, Integer pageSize) {
|
||||
Long topOrganizationId = null;
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long id = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (id != null && id != 1){
|
||||
topOrganizationId = id;
|
||||
}
|
||||
}
|
||||
//return materialBaseInfoDomainService.getMaterialStockList(shipperName,materialName,machineCode,topOrganizationId,pageNum,pageSize);/**/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.mhd.basic.application.service.materialClassify;
|
||||
|
||||
import com.mhd.basic.domain.materialClassify.repository.po.MaterialClassifyPO;
|
||||
import com.mhd.basic.domain.materialClassify.repository.todo.MaterialClassifyDO;
|
||||
import com.mhd.basic.domain.materialClassify.service.MaterialClassifyDomainService;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 物料分类ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaterialClassifyApplicationService {
|
||||
@Autowired
|
||||
private MaterialClassifyDomainService materialClassifyDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询物料分类列表
|
||||
*/
|
||||
|
||||
public List<MaterialClassifyPO> queryList(MaterialClassifyDO materialClassifyDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
materialClassifyDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return materialClassifyDomainService.queryList(materialClassifyDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询物料分类含有所有的子集
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 13:47
|
||||
* @param materialClassifyDO
|
||||
* @return List<MaterialClassifyPO>
|
||||
*/
|
||||
public List<MaterialClassifyPO> queryChildrenList(MaterialClassifyDO materialClassifyDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
materialClassifyDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return materialClassifyDomainService.queryChildrenList(materialClassifyDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增物料分类
|
||||
*/
|
||||
public Boolean insert(MaterialClassifyDO materialClassifyDO) {
|
||||
return materialClassifyDomainService.insert(materialClassifyDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物料分类
|
||||
*/
|
||||
public Boolean update(MaterialClassifyDO materialClassifyDO) {
|
||||
return materialClassifyDomainService.update(materialClassifyDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除物料分类
|
||||
*/
|
||||
public boolean delete(Long[] materialClassifyIds) {
|
||||
return materialClassifyDomainService.delete(materialClassifyIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物料分类详细信息
|
||||
*/
|
||||
public MaterialClassifyPO getInfo(Long materialClassifyId)
|
||||
{
|
||||
return materialClassifyDomainService.getInfo(materialClassifyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据ids批量作废物流分类
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 15:14
|
||||
* @param materialClassifyIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] materialClassifyIds){
|
||||
return materialClassifyDomainService.nullifyByIds(materialClassifyIds);
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.mhd.basic.application.service.pack;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.basic.domain.pack.repository.po.PackPO;
|
||||
import com.mhd.basic.domain.pack.repository.todo.PackDO;
|
||||
import com.mhd.basic.domain.pack.service.PackDomainService;
|
||||
import com.mhd.basic.domain.packDetail.repository.po.PackDetailPO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 包装管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PackApplicationService {
|
||||
@Autowired
|
||||
private PackDomainService packDomainService;
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询包装管理列表
|
||||
*/
|
||||
|
||||
public List<PackPO> queryList(PackDO packDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
packDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return packDomainService.queryList(packDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增包装管理
|
||||
*/
|
||||
public Boolean insert(PackDO packDO) {
|
||||
//设置货主信息
|
||||
shipperParam(packDO);
|
||||
return packDomainService.insert(packDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改包装管理
|
||||
*/
|
||||
public Boolean update(PackDO packDO) {
|
||||
return packDomainService.update(packDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除包装管理
|
||||
*/
|
||||
public boolean delete(Long[] packIds) {
|
||||
return packDomainService.delete(packIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取包装管理详细信息
|
||||
*/
|
||||
public PackPO getInfo(Long packId)
|
||||
{
|
||||
return packDomainService.getInfo(packId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据包装id和单位编码获取包装详情信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/11 14:52
|
||||
* @param packId
|
||||
* @param unitCode
|
||||
* @return PackDetailPO
|
||||
*/
|
||||
public PackDetailPO getInfoByPackIdAndUnitCode(Long packId, String unitCode) {
|
||||
return packDomainService.getInfoByPackIdAndUnitCode(packId, unitCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 封装货主信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/9 20:43
|
||||
* @param packDO
|
||||
*/
|
||||
private void shipperParam(PackDO packDO){
|
||||
AjaxResult ajaxResult = userServiceFeign.getInfo(packDO.getShipperId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取货主信息失败");
|
||||
}
|
||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
packDO.setShipperName(userPo.getUserName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.application.service.packDetail;
|
||||
|
||||
import com.mhd.basic.domain.packDetail.repository.po.PackDetailPO;
|
||||
import com.mhd.basic.domain.packDetail.repository.todo.PackDetailDO;
|
||||
import com.mhd.basic.domain.packDetail.service.PackDetailDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 包装管理详情ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PackDetailApplicationService {
|
||||
@Autowired
|
||||
private PackDetailDomainService packDetailDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询包装管理详情列表
|
||||
*/
|
||||
|
||||
public List<PackDetailPO> queryList(PackDetailDO packDetailDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
packDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return packDetailDomainService.queryList(packDetailDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增包装管理详情
|
||||
*/
|
||||
public Boolean insert(PackDetailDO packDetailDO) {
|
||||
|
||||
return packDetailDomainService.insert(packDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改包装管理详情
|
||||
*/
|
||||
public Boolean update(PackDetailDO packDetailDO) {
|
||||
return packDetailDomainService.update(packDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除包装管理详情
|
||||
*/
|
||||
public boolean delete(Long[] packDetailIds) {
|
||||
return packDetailDomainService.delete(packDetailIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取包装管理详情详细信息
|
||||
*/
|
||||
public PackDetailPO getInfo(Long packDetailId)
|
||||
{
|
||||
return packDetailDomainService.getInfo(packDetailId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package com.mhd.basic.application.service.platform;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
import com.mhd.basic.domain.platform.repository.po.PlatformPO;
|
||||
import com.mhd.basic.domain.platform.repository.todo.PlatformDO;
|
||||
import com.mhd.basic.domain.platform.service.PlatformDomainService;
|
||||
import com.mhd.basic.domain.platformGroup.repository.po.PlatformGroupPO;
|
||||
import com.mhd.basic.domain.platformGroup.service.PlatformGroupDomainService;
|
||||
import com.mhd.basic.domain.warehouse.entity.Warehouse;
|
||||
import com.mhd.basic.domain.warehouse.repository.po.WarehousePO;
|
||||
import com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO;
|
||||
import com.mhd.basic.domain.warehouse.service.WarehouseDomainService;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 月台管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PlatformApplicationService {
|
||||
@Autowired
|
||||
private PlatformDomainService platformDomainService;
|
||||
@Autowired
|
||||
private PlatformGroupDomainService platformGroupDomainService;
|
||||
@Autowired
|
||||
private WarehouseDomainService warehouseDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询月台管理列表
|
||||
*/
|
||||
|
||||
public List<PlatformPO> queryList(PlatformDO platformDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
platformDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return platformDomainService.queryList(platformDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增月台管理
|
||||
*/
|
||||
public Boolean insert(PlatformDO platformDO) {
|
||||
//封装月台组信息
|
||||
if(null != platformDO.getPlatformGroupId() && platformDO.getPlatformGroupId() != 0){
|
||||
platformGroupParam(platformDO);
|
||||
}
|
||||
//封装仓库信息
|
||||
warehouseParam(platformDO);
|
||||
return platformDomainService.insert(platformDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改月台管理
|
||||
*/
|
||||
public Boolean update(PlatformDO platformDO) {
|
||||
//封装月台组信息
|
||||
if(null != platformDO.getPlatformGroupId() && platformDO.getPlatformGroupId() != 0){
|
||||
platformGroupParam(platformDO);
|
||||
}
|
||||
//封装仓库信息
|
||||
warehouseParam(platformDO);
|
||||
return platformDomainService.update(platformDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除月台管理
|
||||
*/
|
||||
public boolean delete(Long[] platformIds) {
|
||||
return platformDomainService.delete(platformIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月台管理详细信息
|
||||
*/
|
||||
public PlatformPO getInfo(Long platformId)
|
||||
{
|
||||
return platformDomainService.getInfo(platformId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据id作废月台
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 14:22
|
||||
* @param platformIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] platformIds){
|
||||
return platformDomainService.nullifyByIds(platformIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 封装月台组信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 10:45
|
||||
* @param platformDO
|
||||
*/
|
||||
private void platformGroupParam(PlatformDO platformDO){
|
||||
//封装月台组信息
|
||||
PlatformGroupPO platformGroupPO = platformGroupDomainService.getInfo(platformDO.getPlatformGroupId());
|
||||
platformDO.setPlatformGroupCode(platformGroupPO.getPlatformGroupCode());
|
||||
platformDO.setPlatformGroupName(platformGroupPO.getPlatformGroupName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 封装仓库信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 20:28
|
||||
* @param platformDO
|
||||
*/
|
||||
private void warehouseParam(PlatformDO platformDO){
|
||||
WarehouseDO warehouseDO = new WarehouseDO();
|
||||
warehouseDO.setWarehouseIds(platformDO.getWarehouseIds());
|
||||
List<WarehousePO> warehousePOList = warehouseDomainService.queryList(warehouseDO);
|
||||
if (CollectionUtil.isEmpty(warehousePOList)){
|
||||
throw new ServiceException("仓库信息不存在");
|
||||
}
|
||||
List<String> warehouseNameList = warehousePOList.stream().map(WarehousePO::getWarehouseName).collect(Collectors.toList());
|
||||
platformDO.setWarehouseNameList(String.join(",", warehouseNameList));
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.mhd.basic.application.service.platformGroup;
|
||||
|
||||
import com.mhd.basic.domain.platform.repository.todo.PlatformDO;
|
||||
import com.mhd.basic.domain.platformGroup.repository.po.PlatformGroupPO;
|
||||
import com.mhd.basic.domain.platformGroup.repository.todo.PlatformGroupDO;
|
||||
import com.mhd.basic.domain.platformGroup.service.PlatformGroupDomainService;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 月台管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PlatformGroupApplicationService {
|
||||
@Autowired
|
||||
private PlatformGroupDomainService platformGroupDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询月台管理列表
|
||||
*/
|
||||
|
||||
public List<PlatformGroupPO> queryList(PlatformGroupDO platformGroupDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
platformGroupDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return platformGroupDomainService.queryList(platformGroupDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增月台管理
|
||||
*/
|
||||
public Boolean insert(PlatformGroupDO platformGroupDO) {
|
||||
return platformGroupDomainService.insert(platformGroupDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改月台管理
|
||||
*/
|
||||
public Boolean update(PlatformGroupDO platformGroupDO) {
|
||||
return platformGroupDomainService.update(platformGroupDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除月台管理
|
||||
*/
|
||||
public boolean delete(Long[] platformGroupIds) {
|
||||
return platformGroupDomainService.delete(platformGroupIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月台管理详细信息
|
||||
*/
|
||||
public PlatformGroupPO getInfo(Long platformGroupId)
|
||||
{
|
||||
return platformGroupDomainService.getInfo(platformGroupId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 批量停用库位组
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param platformGroupIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean stopByIds(Long[] platformGroupIds)
|
||||
{
|
||||
return platformGroupDomainService.stopByIds(platformGroupIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量启用库位组
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param platformGroupIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean startByIds(Long[] platformGroupIds)
|
||||
{
|
||||
return platformGroupDomainService.startByIds(platformGroupIds);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.application.service.platformUseTime;
|
||||
|
||||
import com.mhd.basic.domain.platformUseTime.repository.po.PlatformUseTimePO;
|
||||
import com.mhd.basic.domain.platformUseTime.repository.todo.PlatformUseTimeDO;
|
||||
import com.mhd.basic.domain.platformUseTime.service.PlatformUseTimeDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 月台使用时间管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-13
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PlatformUseTimeApplicationService {
|
||||
@Autowired
|
||||
private PlatformUseTimeDomainService platformUseTimeDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询月台使用时间管理列表
|
||||
*/
|
||||
|
||||
public List<PlatformUseTimePO> queryList(PlatformUseTimeDO platformUseTimeDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
platformUseTimeDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return platformUseTimeDomainService.queryList(platformUseTimeDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增月台使用时间管理
|
||||
*/
|
||||
public Boolean insert(PlatformUseTimeDO platformUseTimeDO) {
|
||||
|
||||
return platformUseTimeDomainService.insert(platformUseTimeDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改月台使用时间管理
|
||||
*/
|
||||
public Boolean update(PlatformUseTimeDO platformUseTimeDO) {
|
||||
return platformUseTimeDomainService.update(platformUseTimeDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除月台使用时间管理
|
||||
*/
|
||||
public boolean delete(Long[] platformUseTimeIds) {
|
||||
return platformUseTimeDomainService.delete(platformUseTimeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月台使用时间管理详细信息
|
||||
*/
|
||||
public PlatformUseTimePO getInfo(Long platformUseTimeId)
|
||||
{
|
||||
return platformUseTimeDomainService.getInfo(platformUseTimeId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package com.mhd.basic.application.service.projectManage;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.projectManage.repository.po.ProjectManagePO;
|
||||
import com.mhd.basic.domain.projectManage.repository.todo.ProjectManageDO;
|
||||
import com.mhd.basic.domain.projectManage.service.ProjectManageDomainService;
|
||||
import com.mhd.basic.interfaces.dto.projectManage.ProjectManageDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 项目管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-05
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProjectManageApplicationService {
|
||||
@Autowired
|
||||
private ProjectManageDomainService projectManageDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询项目管理列表
|
||||
*/
|
||||
public List<ProjectManagePO> queryList(ProjectManageDO projectManageDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
projectManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return projectManageDomainService.queryList(projectManageDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增项目管理
|
||||
*/
|
||||
public Boolean insert(ProjectManageDO projectManageDO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//TODO 根据结算客户id查询结算信息
|
||||
|
||||
//判断项目开始日期是否大于当前日期,项目状态设置为已开始,如果没有大于当前日期项目状态设置为未开始
|
||||
if (projectManageDO.getBeginDate().getTime() <= System.currentTimeMillis()) {
|
||||
projectManageDO.setProjectStats(2);
|
||||
}else {
|
||||
projectManageDO.setProjectStats(1);
|
||||
}
|
||||
projectManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
projectManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
projectManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
return projectManageDomainService.insert(projectManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目管理
|
||||
*/
|
||||
public Boolean update(ProjectManageDO projectManageDO) {
|
||||
//获取登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//TODO 根据结算客户id查询结算信息
|
||||
|
||||
//判断项目开始日期是否大于当前日期,项目状态设置为已开始,如果没有大于当前日期项目状态设置为未开始
|
||||
if (projectManageDO.getBeginDate().getTime() <= System.currentTimeMillis()) {
|
||||
projectManageDO.setProjectStats(2);
|
||||
}else {
|
||||
projectManageDO.setProjectStats(1);
|
||||
}
|
||||
return projectManageDomainService.update(projectManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目管理
|
||||
*/
|
||||
public boolean delete(ProjectManageDTO projectManageDTO) {
|
||||
if(!StringUtils.isNotEmpty(projectManageDTO.getProjectManageIds())){
|
||||
throw new ServiceException("项目管理id不能为空");
|
||||
}
|
||||
Set<String> idSet = Stream.of(projectManageDTO.getProjectManageIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] projectManageIds = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return projectManageDomainService.delete(projectManageIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目管理详细信息
|
||||
*/
|
||||
public ProjectManagePO getInfo(Long projectManageId)
|
||||
{
|
||||
return projectManageDomainService.getInfo(projectManageId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 终止项目
|
||||
*/
|
||||
public boolean stopProject(ProjectManageDTO projectManageDTO) {
|
||||
if(projectManageDTO.getProjectManageId() == null){
|
||||
throw new ServiceException("项目id不能为空");
|
||||
}
|
||||
return projectManageDomainService.stopProject(projectManageDTO.getProjectManageId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取项目信息
|
||||
* @param projectCode
|
||||
* @return
|
||||
*/
|
||||
public ProjectManagePO getInfoByCode(String projectCode) {
|
||||
if(!StringUtils.isNotEmpty(projectCode)){
|
||||
throw new ServiceException("项目编码不能为空");
|
||||
}
|
||||
return projectManageDomainService.getInfoByCode(projectCode);
|
||||
}
|
||||
}
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.mhd.basic.application.service.serviceItemsManage;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.serviceItemsManage.repository.po.ServiceItemsManagePO;
|
||||
import com.mhd.basic.domain.serviceItemsManage.repository.todo.ServiceItemsManageDO;
|
||||
import com.mhd.basic.domain.serviceItemsManage.service.ServiceItemsManageDomainService;
|
||||
import com.mhd.basic.interfaces.dto.serviceItemsManage.ServiceItemsManageDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 服务项管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ServiceItemsManageApplicationService {
|
||||
@Autowired
|
||||
private ServiceItemsManageDomainService serviceItemsManageDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询服务项管理列表
|
||||
*/
|
||||
|
||||
public List<ServiceItemsManagePO> queryList(ServiceItemsManageDO serviceItemsManageDO) {
|
||||
setTopOrganizationIdLogin(serviceItemsManageDO);
|
||||
return serviceItemsManageDomainService.queryList(serviceItemsManageDO);
|
||||
}
|
||||
|
||||
public List<ServiceItemsManagePO> getCostTypeList(ServiceItemsManageDO serviceItemsManageDO){
|
||||
setTopOrganizationIdLogin(serviceItemsManageDO);
|
||||
return serviceItemsManageDomainService.getCostsType(serviceItemsManageDO);
|
||||
}
|
||||
|
||||
private void setTopOrganizationIdLogin(ServiceItemsManageDO serviceItemsManageDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
serviceItemsManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增服务项管理
|
||||
*/
|
||||
public Boolean insert(ServiceItemsManageDO serviceItemsManageDO) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
serviceItemsManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
serviceItemsManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
serviceItemsManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
return serviceItemsManageDomainService.insert(serviceItemsManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务项管理
|
||||
*/
|
||||
public Boolean update(ServiceItemsManageDO serviceItemsManageDO) {
|
||||
return serviceItemsManageDomainService.update(serviceItemsManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除服务项管理
|
||||
*/
|
||||
public boolean delete(ServiceItemsManageDTO serviceItemsManageDTO) {
|
||||
if(!StringUtils.isNotEmpty(serviceItemsManageDTO.getServiceItemsManageIds())){
|
||||
throw new ServiceException("服务项管理id不能为空");
|
||||
}
|
||||
Set<String> idSet = Stream.of(serviceItemsManageDTO.getServiceItemsManageIds().split(",")).collect(Collectors.toSet());
|
||||
Long[] serviceItemsManageIds = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||
return serviceItemsManageDomainService.delete(serviceItemsManageIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务项管理详细信息
|
||||
*/
|
||||
public ServiceItemsManagePO getInfo(Long serviceItemsManageId)
|
||||
{
|
||||
return serviceItemsManageDomainService.getInfo(serviceItemsManageId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据编码获取服务项管理详细信息
|
||||
* @param serviceItemsCode
|
||||
* @return
|
||||
*/
|
||||
public ServiceItemsManagePO getServiceItemsByCode(String serviceItemsCode) {
|
||||
return serviceItemsManageDomainService.getServiceItemsByCode(serviceItemsCode);
|
||||
}
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
package com.mhd.basic.application.service.storageLocation;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mhd.basic.domain.storageLocation.repository.po.StorageLocationPO;
|
||||
import com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO;
|
||||
import com.mhd.basic.domain.storageLocation.service.StorageLocationDomainService;
|
||||
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 库位ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-04-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StorageLocationApplicationService {
|
||||
@Autowired
|
||||
private StorageLocationDomainService storageLocationDomainService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询库位列表
|
||||
*/
|
||||
|
||||
public List<StorageLocationPO> queryList(StorageLocationDO storageLocationDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
storageLocationDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
storageLocationDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
return storageLocationDomainService.queryList(storageLocationDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增库位
|
||||
*/
|
||||
public Boolean insert(StorageLocationDO storageLocationDO) {
|
||||
//设置组织信息
|
||||
setOrganizationParams(storageLocationDO);
|
||||
//设置数据字典键值
|
||||
setDataDict(storageLocationDO);
|
||||
return storageLocationDomainService.insert(storageLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库位
|
||||
*/
|
||||
public Boolean update(StorageLocationDO storageLocationDO) {
|
||||
//设置数据字典键值
|
||||
setDataDict(storageLocationDO);
|
||||
return storageLocationDomainService.update(storageLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增库位
|
||||
*/
|
||||
public Boolean batchInsert(StorageLocationDO storageLocationDO) {
|
||||
//设置数据字典键值
|
||||
setDataDict(storageLocationDO);
|
||||
return storageLocationDomainService.batchInsert(storageLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置数据字典键值
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 14:33
|
||||
* @param storageLocationDO
|
||||
*/
|
||||
private void setDataDict(StorageLocationDO storageLocationDO){
|
||||
//翻译库位分类
|
||||
List<SysDictData> storageTypeDictDataList = dictTypeService.selectDictDataByType(DictCode.STORAGE_LOCATION_CLASSIFICATION.getCode());
|
||||
if (storageTypeDictDataList == null){
|
||||
throw new ServiceException("库位分类数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData storageTypeDictData = storageTypeDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), storageLocationDO.getStorageLocationClassify())).findAny().orElse(null);
|
||||
if (null == storageTypeDictData) {
|
||||
throw new ServiceException("库位分类【" + storageLocationDO.getStorageLocationClassify() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
storageLocationDO.setStorageLocationClassifyName(storageTypeDictData.getDictLabel());
|
||||
|
||||
//翻译库位种类
|
||||
List<SysDictData> storageLocationTypeDictDataList = dictTypeService.selectDictDataByType(DictCode.STORAGE_LOCATION_TYPE.getCode());
|
||||
if (storageLocationTypeDictDataList == null){
|
||||
throw new ServiceException("库位种类数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData storageLocationTypeDictData = storageLocationTypeDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), storageLocationDO.getStorageLocationType())).findAny().orElse(null);
|
||||
if (null == storageLocationTypeDictData) {
|
||||
throw new ServiceException("库位种类【" + storageLocationDO.getStorageLocationClassify() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
storageLocationDO.setStorageLocationTypeName(storageLocationTypeDictData.getDictLabel());
|
||||
|
||||
//翻译混放策略
|
||||
List<SysDictData> mixingStrategyDictDataList = dictTypeService.selectDictDataByType(DictCode.CONFUSION_STRATEGY.getCode());
|
||||
if (mixingStrategyDictDataList == null){
|
||||
throw new ServiceException("混放策略数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData mixingStrategyDictData = mixingStrategyDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), storageLocationDO.getMixingStrategy())).findAny().orElse(null);
|
||||
if (null == mixingStrategyDictData) {
|
||||
throw new ServiceException("混放策略【" + storageLocationDO.getStorageLocationClassify() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
storageLocationDO.setMixingStrategyName(mixingStrategyDictData.getDictLabel());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库位
|
||||
*/
|
||||
public boolean delete(Long[] storageLocationIds) {
|
||||
return storageLocationDomainService.delete(storageLocationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库位详细信息
|
||||
*/
|
||||
public StorageLocationPO getInfo(Long storageLocationId)
|
||||
{
|
||||
return storageLocationDomainService.getInfo(storageLocationId);
|
||||
}
|
||||
|
||||
public int getStorageLocationCount(StorageLocationDO storageLocationDO)
|
||||
{
|
||||
return storageLocationDomainService.getStorageLocationCount(storageLocationDO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description 批量停用库位
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param storageLocationIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean stopByIds(Long[] storageLocationIds)
|
||||
{
|
||||
return storageLocationDomainService.stopByIds(storageLocationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量启用库位
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param storageLocationIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean startByIds(Long[] storageLocationIds)
|
||||
{
|
||||
return storageLocationDomainService.startByIds(storageLocationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置组织信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 8:56
|
||||
* @param storageLocationDO
|
||||
*/
|
||||
private void setOrganizationParams(StorageLocationDO storageLocationDO){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
storageLocationDO.setOrganizationId(userPo.getOrganizationId());
|
||||
storageLocationDO.setOrganizationName(userPo.getOrganizationName());
|
||||
storageLocationDO.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.mhd.basic.application.service.storageLocationGroup;
|
||||
|
||||
import com.mhd.basic.domain.storageLocationGroup.repository.po.StorageLocationGroupPO;
|
||||
import com.mhd.basic.domain.storageLocationGroup.repository.todo.StorageLocationGroupDO;
|
||||
import com.mhd.basic.domain.storageLocationGroup.service.StorageLocationGroupDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 库位组ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-04-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StorageLocationGroupApplicationService {
|
||||
@Autowired
|
||||
private StorageLocationGroupDomainService storageLocationGroupDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询库位组列表
|
||||
*/
|
||||
|
||||
public List<StorageLocationGroupPO> queryList(StorageLocationGroupDO storageLocationGroupDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
storageLocationGroupDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
if (organizationId != null && organizationId != 1){
|
||||
storageLocationGroupDO.setOrganizationId(organizationId);
|
||||
}
|
||||
}
|
||||
return storageLocationGroupDomainService.queryList(storageLocationGroupDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增库位组
|
||||
*/
|
||||
public Boolean insert(StorageLocationGroupDO storageLocationGroupDO) {
|
||||
|
||||
return storageLocationGroupDomainService.insert(storageLocationGroupDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库位组
|
||||
*/
|
||||
public Boolean update(StorageLocationGroupDO storageLocationGroupDO) {
|
||||
return storageLocationGroupDomainService.update(storageLocationGroupDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库位组
|
||||
*/
|
||||
public boolean delete(Long[] storageLocationGroupIds) {
|
||||
return storageLocationGroupDomainService.delete(storageLocationGroupIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库位组详细信息
|
||||
*/
|
||||
public StorageLocationGroupPO getInfo(Long storageLocationGroupId)
|
||||
{
|
||||
return storageLocationGroupDomainService.getInfo(storageLocationGroupId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量停用库位组
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param storageLocationGroupIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean stopByIds(Long[] storageLocationGroupIds)
|
||||
{
|
||||
return storageLocationGroupDomainService.stopByIds(storageLocationGroupIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量启用库位组
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 10:09
|
||||
* @param storageLocationGroupIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean startByIds(Long[] storageLocationGroupIds)
|
||||
{
|
||||
return storageLocationGroupDomainService.startByIds(storageLocationGroupIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.mhd.basic.application.service.storageSection;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mhd.basic.domain.storageSection.repository.po.StorageSectionPO;
|
||||
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
|
||||
import com.mhd.basic.domain.storageSection.service.StorageSectionDomainService;
|
||||
import com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO;
|
||||
import com.mhd.basic.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.common.core.domain.dto.SysProvinceCityCountyDTO;
|
||||
import com.mhd.common.core.domain.po.SysAreaPO;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 库区ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-04-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StorageSectionApplicationService {
|
||||
@Autowired
|
||||
private StorageSectionDomainService storageSectionDomainService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询库区列表
|
||||
*/
|
||||
|
||||
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
storageSectionDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return storageSectionDomainService.queryList(storageSectionDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增库区
|
||||
*/
|
||||
public Boolean insert(StorageSectionDO storageSectionDO) {
|
||||
//翻译库区类型
|
||||
setDataDict(storageSectionDO);
|
||||
return storageSectionDomainService.insert(storageSectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库区
|
||||
*/
|
||||
public Boolean update(StorageSectionDO storageSectionDO) {
|
||||
//翻译库区类型
|
||||
setDataDict(storageSectionDO);
|
||||
return storageSectionDomainService.update(storageSectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置数据字典键值
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 14:33
|
||||
* @param storageSectionDO
|
||||
*/
|
||||
private void setDataDict(StorageSectionDO storageSectionDO){
|
||||
//翻译库区类型
|
||||
List<SysDictData> storageTypeDictDataList = dictTypeService.selectDictDataByType(DictCode.STORAGE_SECTION_TYPE.getCode());
|
||||
if (null == storageTypeDictDataList) {
|
||||
throw new ServiceException("库区类型数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData storageTypeDictData = storageTypeDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), storageSectionDO.getStorageType())).findAny().orElse(null);
|
||||
if (null == storageTypeDictData) {
|
||||
throw new ServiceException("库区类型【" + storageSectionDO.getStorageType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
storageSectionDO.setStorageTypeName(storageTypeDictData.getDictLabel());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库区
|
||||
*/
|
||||
public boolean delete(Long[] storageSectionIds) {
|
||||
return storageSectionDomainService.delete(storageSectionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库区详细信息
|
||||
*/
|
||||
public StorageSectionPO getInfo(Long storageSectionId)
|
||||
{
|
||||
return storageSectionDomainService.getInfo(storageSectionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 作废仓库
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/3 17:06
|
||||
* @param storageSectionIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] storageSectionIds){
|
||||
return storageSectionDomainService.nullifyByIds(storageSectionIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.application.service.systemOpenApiLog;
|
||||
|
||||
import com.mhd.basic.domain.systemOpenApiLog.repository.po.SystemOpenApiLogPO;
|
||||
import com.mhd.basic.domain.systemOpenApiLog.repository.todo.SystemOpenApiLogDO;
|
||||
import com.mhd.basic.domain.systemOpenApiLog.service.SystemOpenApiLogDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 开放接口日志记录ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SystemOpenApiLogApplicationService {
|
||||
@Autowired
|
||||
private SystemOpenApiLogDomainService systemOpenApiLogDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询开放接口日志记录列表
|
||||
*/
|
||||
|
||||
public List<SystemOpenApiLogPO> queryList(SystemOpenApiLogDO systemOpenApiLogDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
systemOpenApiLogDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return systemOpenApiLogDomainService.queryList(systemOpenApiLogDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增开放接口日志记录
|
||||
*/
|
||||
public Boolean insert(SystemOpenApiLogDO systemOpenApiLogDO) {
|
||||
|
||||
return systemOpenApiLogDomainService.insert(systemOpenApiLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改开放接口日志记录
|
||||
*/
|
||||
public Boolean update(SystemOpenApiLogDO systemOpenApiLogDO) {
|
||||
return systemOpenApiLogDomainService.update(systemOpenApiLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除开放接口日志记录
|
||||
*/
|
||||
public boolean delete(Long[] openApiLogIds) {
|
||||
return systemOpenApiLogDomainService.delete(openApiLogIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开放接口日志记录详细信息
|
||||
*/
|
||||
public SystemOpenApiLogPO getInfo(Long openApiLogId)
|
||||
{
|
||||
return systemOpenApiLogDomainService.getInfo(openApiLogId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.application.service.thirdPartyServiceReqLog;
|
||||
|
||||
import com.mhd.basic.domain.thirdPartyServiceReqLog.repository.po.ThirdPartyServiceReqLogPO;
|
||||
import com.mhd.basic.domain.thirdPartyServiceReqLog.repository.todo.ThirdPartyServiceReqLogDO;
|
||||
import com.mhd.basic.domain.thirdPartyServiceReqLog.service.ThirdPartyServiceReqLogDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 三方服务请求日志ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThirdPartyServiceReqLogApplicationService {
|
||||
@Autowired
|
||||
private ThirdPartyServiceReqLogDomainService thirdPartyServiceReqLogDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询三方服务请求日志列表
|
||||
*/
|
||||
|
||||
public List<ThirdPartyServiceReqLogPO> queryList(ThirdPartyServiceReqLogDO thirdPartyServiceReqLogDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
thirdPartyServiceReqLogDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return thirdPartyServiceReqLogDomainService.queryList(thirdPartyServiceReqLogDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增三方服务请求日志
|
||||
*/
|
||||
public Boolean insert(ThirdPartyServiceReqLogDO thirdPartyServiceReqLogDO) {
|
||||
|
||||
return thirdPartyServiceReqLogDomainService.insert(thirdPartyServiceReqLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改三方服务请求日志
|
||||
*/
|
||||
public Boolean update(ThirdPartyServiceReqLogDO thirdPartyServiceReqLogDO) {
|
||||
return thirdPartyServiceReqLogDomainService.update(thirdPartyServiceReqLogDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除三方服务请求日志
|
||||
*/
|
||||
public boolean delete(Long[] thiParSerReqLogIds) {
|
||||
return thirdPartyServiceReqLogDomainService.delete(thiParSerReqLogIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取三方服务请求日志详细信息
|
||||
*/
|
||||
public ThirdPartyServiceReqLogPO getInfo(Long thiParSerReqLogId)
|
||||
{
|
||||
return thirdPartyServiceReqLogDomainService.getInfo(thiParSerReqLogId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.mhd.basic.application.service.warehouse;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.domain.areaAggregate.service.SysProvinceCityCountyDomainService;
|
||||
import com.mhd.basic.domain.warehouse.repository.po.WarehousePO;
|
||||
import com.mhd.basic.domain.warehouse.repository.po.po.WarehouseLinkagePO;
|
||||
import com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO;
|
||||
import com.mhd.basic.domain.warehouse.service.WarehouseDomainService;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 仓库ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-04-03
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WarehouseApplicationService {
|
||||
@Autowired
|
||||
private WarehouseDomainService warehouseDomainService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private SysProvinceCityCountyDomainService sysProvinceCityCountyDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询仓库列表
|
||||
*/
|
||||
|
||||
public List<WarehousePO> queryList(WarehouseDO warehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
warehouseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return warehouseDomainService.queryList(warehouseDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增仓库
|
||||
*/
|
||||
public Boolean insert(WarehouseDO warehouseDO) {
|
||||
//设置数据字典键值
|
||||
setDataDict(warehouseDO);
|
||||
return warehouseDomainService.insert(warehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
*/
|
||||
public Boolean update(WarehouseDO warehouseDO) {
|
||||
//设置数据字典键值
|
||||
setDataDict(warehouseDO);
|
||||
return warehouseDomainService.update(warehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置数据字典键值
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 14:33
|
||||
* @param warehouseDO
|
||||
*/
|
||||
private void setDataDict(WarehouseDO warehouseDO){
|
||||
//翻译仓库类型
|
||||
List<SysDictData> warehouseDictDataList = dictTypeService.selectDictDataByType(DictCode.WAREHOUSE_TYPE.getCode());
|
||||
if (null == warehouseDictDataList) {
|
||||
throw new ServiceException("仓库类型数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData warehouseDictData = warehouseDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), warehouseDO.getWarehouseType())).findAny().orElse(null);
|
||||
if (null == warehouseDictData) {
|
||||
throw new ServiceException("仓库类型【" + warehouseDO.getWarehouseType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
warehouseDO.setWarehouseTypeName(warehouseDictData.getDictLabel());
|
||||
//翻译温层
|
||||
List<SysDictData> warmLayerDictDataList = dictTypeService.selectDictDataByType(DictCode.WAREHOUSE_WARM_LAYER.getCode());
|
||||
if (null == warmLayerDictDataList) {
|
||||
throw new ServiceException("温层数据字典不存在 请联系管理员");
|
||||
}
|
||||
SysDictData warmLayerDictDataVo = warmLayerDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), warehouseDO.getWarmLayerCode())).findAny().orElse(null);
|
||||
if (null == warmLayerDictDataVo) {
|
||||
throw new ServiceException("温层类型【" + warehouseDO.getWarehouseType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
warehouseDO.setWarmLayerName(warmLayerDictDataVo.getDictLabel());
|
||||
//翻译省市区
|
||||
SysProvinceCityCountyDO loadingProvinceCityCountyDO = new SysProvinceCityCountyDO();
|
||||
loadingProvinceCityCountyDO.setCountyCode(Long.parseLong(warehouseDO.getRegionCode()));
|
||||
SysAreaPO sysAreaPO = sysProvinceCityCountyDomainService.findAreaInfo(loadingProvinceCityCountyDO);
|
||||
warehouseDO.setRegionName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除仓库
|
||||
*/
|
||||
public boolean delete(Long[] warehouseIds) {
|
||||
return warehouseDomainService.delete(warehouseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库详细信息
|
||||
*/
|
||||
public WarehousePO getInfo(Long warehouseId)
|
||||
{
|
||||
return warehouseDomainService.getInfo(warehouseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 作废仓库
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/3 17:06
|
||||
* @param warehouseIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] warehouseIds){
|
||||
return warehouseDomainService.nullifyByIds(warehouseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取仓库及下库区及库位
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/14 14:29
|
||||
* @param warehouseId
|
||||
* @return WarehousePO
|
||||
*/
|
||||
public List<WarehouseLinkagePO> getWarehouseChildren(Long warehouseId){
|
||||
return warehouseDomainService.getWarehouseChildren(warehouseId);
|
||||
}
|
||||
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿对象 abnormal_address_book
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AbnormalAddressBook extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("异常匹配地址簿id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long abnormalAddressBookId;
|
||||
|
||||
@ApiModelProperty("一级组织表id")
|
||||
@Excel(name = "一级组织表id")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@Excel(name = "id")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("地址类型(1-装货签到,2-卸货签到)")
|
||||
@Excel(name = "地址类型", readConverterExp = "1=-装货签到,2-卸货签到")
|
||||
private Integer addressSignType;
|
||||
|
||||
@ApiModelProperty("货源单id")
|
||||
@Excel(name = "货源单id")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("运单id")
|
||||
@Excel(name = "运单id")
|
||||
private String transportationId;
|
||||
|
||||
@ApiModelProperty("运输单号")
|
||||
@Excel(name = "运输单号")
|
||||
private String transportationNumber;
|
||||
|
||||
@ApiModelProperty("货源单号")
|
||||
@Excel(name = "货源单号")
|
||||
private String goodsNumber;
|
||||
|
||||
@ApiModelProperty("省市区编码")
|
||||
@Excel(name = "省市区编码")
|
||||
private String actualAreaId;
|
||||
|
||||
@ApiModelProperty("省市区名称")
|
||||
@Excel(name = "省市区名称")
|
||||
private String actualAreaName;
|
||||
|
||||
@ApiModelProperty("原地址")
|
||||
@Excel(name = "原地址")
|
||||
private String originalAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地址")
|
||||
@Excel(name = "实际签到地址")
|
||||
private String actualAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地经度")
|
||||
@Excel(name = "实际签到地经度")
|
||||
private String actualLongitude;
|
||||
|
||||
@ApiModelProperty("实际签到地纬度")
|
||||
@Excel(name = "实际签到地纬度")
|
||||
private String actualLatitude;
|
||||
|
||||
@ApiModelProperty("审核人用户ID")
|
||||
@Excel(name = "审核人用户ID")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty("审核人名称")
|
||||
@Excel(name = "审核人名称")
|
||||
private String auditByName;
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.entity.AbnormalAddressBook;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.po.AbnormalAddressBookPO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.todo.AbnormalAddressBookDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
public interface IAbnormalAddressBookService extends IService<AbnormalAddressBook>
|
||||
{
|
||||
/**
|
||||
* 分页查询异常匹配地址簿列表
|
||||
*/
|
||||
public List<AbnormalAddressBookPO> queryList(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
|
||||
/**
|
||||
* 新增异常匹配地址簿
|
||||
*/
|
||||
public Boolean insert(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
|
||||
/**
|
||||
* 修改异常匹配地址簿
|
||||
*/
|
||||
public Boolean update(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
|
||||
/**
|
||||
* 批量删除异常匹配地址簿
|
||||
*/
|
||||
public Boolean delete(Long[] abnormalAddressBookIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询异常匹配地址簿
|
||||
*/
|
||||
public AbnormalAddressBookPO getInfo(Long abnormalAddressBookId);
|
||||
|
||||
AbnormalAddressBookPO matchAddressBook(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.entity.AbnormalAddressBook;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.po.AbnormalAddressBookPO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.todo.AbnormalAddressBookDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
public interface AbnormalAddressBookMapper extends BaseMapper<AbnormalAddressBook>
|
||||
{
|
||||
/**
|
||||
* 查询异常匹配地址簿列表
|
||||
*/
|
||||
public List<AbnormalAddressBookPO> queryList(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
|
||||
|
||||
AbnormalAddressBookPO matchAddressBook(AbnormalAddressBookDO abnormalAddressBookDO);
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.entity.AbnormalAddressBook;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.facade.IAbnormalAddressBookService;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.mapper.AbnormalAddressBookMapper;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.po.AbnormalAddressBookPO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.todo.AbnormalAddressBookDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
@Service
|
||||
public class AbnormalAddressBookImpl extends ServiceImpl<AbnormalAddressBookMapper, AbnormalAddressBook> implements IAbnormalAddressBookService{
|
||||
@Autowired
|
||||
private AbnormalAddressBookMapper abnormalAddressBookMapper;
|
||||
|
||||
/**
|
||||
* 查询异常匹配地址簿列表
|
||||
*/
|
||||
@Override
|
||||
public List<AbnormalAddressBookPO> queryList(AbnormalAddressBookDO abnormalAddressBookDO)
|
||||
{
|
||||
return abnormalAddressBookMapper.queryList(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增异常匹配地址簿
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
AbnormalAddressBook abnormalAddressBook = new AbnormalAddressBook();
|
||||
BeanUtils.copyProperties(abnormalAddressBookDO,abnormalAddressBook);
|
||||
return this.save(abnormalAddressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常匹配地址簿
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
AbnormalAddressBook abnormalAddressBook = new AbnormalAddressBook();
|
||||
BeanUtils.copyProperties(abnormalAddressBookDO,abnormalAddressBook);
|
||||
return this.updateById(abnormalAddressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除异常匹配地址簿
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] abnormalAddressBookIds ) {
|
||||
List<AbnormalAddressBook> list = new ArrayList<>();
|
||||
for (Long id : abnormalAddressBookIds) {
|
||||
AbnormalAddressBook abnormalAddressBook = new AbnormalAddressBook();
|
||||
abnormalAddressBook.setAbnormalAddressBookId(id);
|
||||
abnormalAddressBook.setDelFlag(2);
|
||||
list.add(abnormalAddressBook);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常匹配地址簿
|
||||
*/
|
||||
@Override
|
||||
public AbnormalAddressBookPO getInfo(Long abnormalAddressBookId) {
|
||||
AbnormalAddressBook abnormalAddressBook = this.getById(abnormalAddressBookId);
|
||||
AbnormalAddressBookPO abnormalAddressBookPO = new AbnormalAddressBookPO();
|
||||
BeanUtils.copyProperties(abnormalAddressBook,abnormalAddressBookPO);
|
||||
return abnormalAddressBookPO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbnormalAddressBookPO matchAddressBook(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
return abnormalAddressBookMapper.matchAddressBook(abnormalAddressBookDO);
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿对象 abnormal_address_book
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "异常匹配地址簿对象", description = "异常匹配地址簿响应对象")
|
||||
public class AbnormalAddressBookPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("异常匹配地址簿id")
|
||||
private Long abnormalAddressBookId;
|
||||
|
||||
@ApiModelProperty("一级组织表id")
|
||||
@Excel(name = "一级组织表id")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@Excel(name = "id")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("地址类型(1-装货签到,2-卸货签到)")
|
||||
@Excel(name = "地址类型", readConverterExp = "1=-装货签到,2-卸货签到")
|
||||
private Integer addressSignType;
|
||||
|
||||
@ApiModelProperty("货源单id")
|
||||
@Excel(name = "货源单id")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("运单id")
|
||||
@Excel(name = "运单id")
|
||||
private String transportationId;
|
||||
|
||||
@ApiModelProperty("运输单号")
|
||||
@Excel(name = "运输单号")
|
||||
private String transportationNumber;
|
||||
|
||||
@ApiModelProperty("货源单号")
|
||||
@Excel(name = "货源单号")
|
||||
private String goodsNumber;
|
||||
|
||||
@ApiModelProperty("省市区编码")
|
||||
@Excel(name = "省市区编码")
|
||||
private String actualAreaId;
|
||||
|
||||
@ApiModelProperty("省市区名称")
|
||||
@Excel(name = "省市区名称")
|
||||
private String actualAreaName;
|
||||
|
||||
@ApiModelProperty("原地址")
|
||||
@Excel(name = "原地址")
|
||||
private String originalAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地址")
|
||||
@Excel(name = "实际签到地址")
|
||||
private String actualAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地经度")
|
||||
@Excel(name = "实际签到地经度")
|
||||
private String actualLongitude;
|
||||
|
||||
@ApiModelProperty("实际签到地纬度")
|
||||
@Excel(name = "实际签到地纬度")
|
||||
private String actualLatitude;
|
||||
|
||||
@ApiModelProperty("审核人用户ID")
|
||||
@Excel(name = "审核人用户ID")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty("审核人名称")
|
||||
@Excel(name = "审核人名称")
|
||||
private String auditByName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 异常匹配地址簿对象 abnormal_address_book
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AbnormalAddressBookDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("异常匹配地址簿id")
|
||||
private Long abnormalAddressBookId;
|
||||
|
||||
@ApiModelProperty("一级组织表id")
|
||||
@Excel(name = "一级组织表id")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@Excel(name = "id")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("地址类型(1-装货签到,2-卸货签到)")
|
||||
@Excel(name = "地址类型", readConverterExp = "1=-装货签到,2-卸货签到")
|
||||
private Integer addressSignType;
|
||||
|
||||
@ApiModelProperty("货源单id")
|
||||
@Excel(name = "货源单id")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("运单id")
|
||||
@Excel(name = "运单id")
|
||||
private String transportationId;
|
||||
|
||||
@ApiModelProperty("运输单号")
|
||||
@Excel(name = "运输单号")
|
||||
private String transportationNumber;
|
||||
|
||||
@ApiModelProperty("货源单号")
|
||||
@Excel(name = "货源单号")
|
||||
private String goodsNumber;
|
||||
|
||||
@ApiModelProperty("省市区编码")
|
||||
@Excel(name = "省市区编码")
|
||||
private String actualAreaId;
|
||||
|
||||
@ApiModelProperty("省市区名称")
|
||||
@Excel(name = "省市区名称")
|
||||
private String actualAreaName;
|
||||
|
||||
@ApiModelProperty("原地址")
|
||||
@Excel(name = "原地址")
|
||||
private String originalAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地址")
|
||||
@Excel(name = "实际签到地址")
|
||||
private String actualAddress;
|
||||
|
||||
@ApiModelProperty("实际签到地经度")
|
||||
@Excel(name = "实际签到地经度")
|
||||
private String actualLongitude;
|
||||
|
||||
@ApiModelProperty("实际签到地纬度")
|
||||
@Excel(name = "实际签到地纬度")
|
||||
private String actualLatitude;
|
||||
|
||||
@ApiModelProperty("审核人用户ID")
|
||||
@Excel(name = "审核人用户ID")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty("审核人名称")
|
||||
@Excel(name = "审核人名称")
|
||||
private String auditByName;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
/**
|
||||
* 创建日期开始
|
||||
*/
|
||||
@ApiModelProperty("创建日期开始")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
/**
|
||||
* 创建日期结束
|
||||
*/
|
||||
@ApiModelProperty("创建日期结束")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.domain.abnormalAddressBook.service;
|
||||
|
||||
import com.mhd.basic.domain.abnormalAddressBook.entity.AbnormalAddressBook;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.facade.IAbnormalAddressBookService;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.po.AbnormalAddressBookPO;
|
||||
import com.mhd.basic.domain.abnormalAddressBook.repository.todo.AbnormalAddressBookDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 异常匹配地址簿
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-23
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AbnormalAddressBookDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAbnormalAddressBookService abnormalAddressBookService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询异常匹配地址簿列表
|
||||
*/
|
||||
public List<AbnormalAddressBookPO> queryList(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
return abnormalAddressBookService.queryList(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增异常匹配地址簿
|
||||
*/
|
||||
public Boolean insert(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
|
||||
return abnormalAddressBookService.insert(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常匹配地址簿
|
||||
*/
|
||||
public Boolean update(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
return abnormalAddressBookService.update(abnormalAddressBookDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除异常匹配地址簿
|
||||
*/
|
||||
public Boolean delete(Long[] abnormalAddressBookIds) {
|
||||
return abnormalAddressBookService.delete(abnormalAddressBookIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常匹配地址簿详细信息
|
||||
*/
|
||||
public AbnormalAddressBookPO getInfo(Long abnormalAddressBookId)
|
||||
{
|
||||
return abnormalAddressBookService.getInfo(abnormalAddressBookId);
|
||||
}
|
||||
|
||||
|
||||
public void saveBatchAddressBook(List<AbnormalAddressBook> list) {
|
||||
abnormalAddressBookService.saveBatch(list);
|
||||
}
|
||||
|
||||
public AbnormalAddressBookPO matchAddressBook(AbnormalAddressBookDO abnormalAddressBookDO) {
|
||||
return abnormalAddressBookService.matchAddressBook(abnormalAddressBookDO);
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.basic.domain.addressBook.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 地址簿对象 实体
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Data
|
||||
@TableName("address_book")
|
||||
public class AddressBook extends BaseVOEntity implements Serializable
|
||||
{
|
||||
@ApiModelProperty(name = "地址簿id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long addressBookId;
|
||||
@ApiModelProperty(name = "用户ID")
|
||||
private Long userId;
|
||||
@ApiModelProperty(name = "联系人")
|
||||
private String linkMan;
|
||||
@ApiModelProperty(name = "联系方式")
|
||||
private String linkPhone;
|
||||
@ApiModelProperty(name = "省份编码")
|
||||
private Long provinceCode;
|
||||
@ApiModelProperty(name = "城市编码")
|
||||
private Long cityCode;
|
||||
@ApiModelProperty(name = "县区编码")
|
||||
private Long countyCode;
|
||||
@ApiModelProperty(name = "省份名称")
|
||||
private String provinceName;
|
||||
@ApiModelProperty(name = "城市名称")
|
||||
private String cityName;
|
||||
@ApiModelProperty(name = "县区名称")
|
||||
private String countyName;
|
||||
@ApiModelProperty(name = "省市区名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty(name = "地址")
|
||||
private String address;
|
||||
@ApiModelProperty(name = "门牌信息")
|
||||
private String doorplate;
|
||||
@ApiModelProperty(name = "备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(name = "是否默认地址:1.默认2.不默认")
|
||||
private Integer defaultStatus;
|
||||
@ApiModelProperty(name = "经度")
|
||||
private String longitude;
|
||||
@ApiModelProperty(name = "纬度")
|
||||
private String latitude;
|
||||
@ApiModelProperty(name = "地址小区")
|
||||
private String addressPlot;
|
||||
@ApiModelProperty(name = "单位名称")
|
||||
private String unitName;
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package com.mhd.basic.domain.addressBook.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 常用路线对象 common_route
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Data
|
||||
@TableName("common_route")
|
||||
public class CommonRoute extends BaseVOEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 常用路线id */
|
||||
@ApiModelProperty(name = "常用路线id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commonRouteId;
|
||||
|
||||
/** 用户ID */
|
||||
@ApiModelProperty(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 发货地址簿id */
|
||||
@ApiModelProperty(name = "发货地址簿id")
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private Long sendAddressId;
|
||||
|
||||
/** 途径地地址簿id集合 */
|
||||
@ApiModelProperty(name = "途径地地址簿id集合")
|
||||
private String throughAddressId;
|
||||
|
||||
/** 收货地址簿id */
|
||||
@ApiModelProperty(name = "收货地址簿id")
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private Long receiveAddressId;
|
||||
|
||||
@ApiModelProperty("发货联系人")
|
||||
@Excel(name = "发货联系人")
|
||||
private String mailName;
|
||||
|
||||
@ApiModelProperty("发货联系方式")
|
||||
@Excel(name = "发货联系方式")
|
||||
private String mailPhone;
|
||||
|
||||
@ApiModelProperty("发货县区编码")
|
||||
@Excel(name = "发货县区编码")
|
||||
private Long mailCountyCode;
|
||||
|
||||
@ApiModelProperty("发货县区名称")
|
||||
@Excel(name = "发货县区名称")
|
||||
private String mailCountyName;
|
||||
|
||||
@ApiModelProperty("发货门牌信息")
|
||||
@Excel(name = "发货门牌信息")
|
||||
private String mailDoorplate;
|
||||
|
||||
/** 发货地址 */
|
||||
@ApiModelProperty(name = "发货地址")
|
||||
private String mailAddress;
|
||||
|
||||
/** 发货地址经度 */
|
||||
@ApiModelProperty(name = "发货地址经度")
|
||||
private String sendLongitude;
|
||||
|
||||
/** 发货地址纬度 */
|
||||
@ApiModelProperty(name = "发货地址纬度")
|
||||
private String sendLatitude;
|
||||
|
||||
@ApiModelProperty("收货联系人")
|
||||
@Excel(name = "收货联系人")
|
||||
private String addresseeName;
|
||||
|
||||
@ApiModelProperty("收货联系方式")
|
||||
@Excel(name = "收货联系方式")
|
||||
private String addresseePhone;
|
||||
|
||||
@ApiModelProperty("收货县区编码")
|
||||
@Excel(name = "收货县区编码")
|
||||
private Long addresseeCountyCode;
|
||||
|
||||
@ApiModelProperty("收货县区名称")
|
||||
@Excel(name = "收货县区名称")
|
||||
private String addresseeCountyName;
|
||||
|
||||
@ApiModelProperty("收货门牌信息")
|
||||
@Excel(name = "收货门牌信息")
|
||||
private String addresseeDoorplate;
|
||||
|
||||
/** 收货地址 */
|
||||
@ApiModelProperty(name = "收货地址")
|
||||
private String addresseeAddress;
|
||||
|
||||
/** 收货地址经度 */
|
||||
@ApiModelProperty(name = "收货地址经度")
|
||||
private String receiveLongitude;
|
||||
|
||||
/** 收货地址纬度 */
|
||||
@ApiModelProperty(name = "收货地址纬度")
|
||||
private String receiveLatitude;
|
||||
|
||||
@ApiModelProperty(name = "发货地址小区")
|
||||
private String mailAddressPlot;
|
||||
|
||||
@ApiModelProperty(name = "收货地址小区")
|
||||
private String addresseeAddressPlot;
|
||||
|
||||
@ApiModelProperty(name = "线路名称")
|
||||
private java.lang.String lineName;
|
||||
|
||||
@ApiModelProperty(name = "运距(千米)")
|
||||
private java.math.BigDecimal haulDistance;
|
||||
|
||||
/** 发货单位名称 */
|
||||
@ApiModelProperty(name = "发货单位名称")
|
||||
private String sendUnitName;
|
||||
|
||||
/** 收货单位名称 */
|
||||
@ApiModelProperty(name = "收货单位名称")
|
||||
private String receiveUnitName;
|
||||
|
||||
@ApiModelProperty(name = "运费单价")
|
||||
private BigDecimal freightUnitPrice;
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.facade;
|
||||
|
||||
import com.mhd.basic.domain.addressBook.entity.AddressBook;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.common.core.domain.po.AddressBookPo;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地址簿 业务层
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface AddressBookRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* 查询地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 地址簿
|
||||
*/
|
||||
public AddressBookPo selectAddressBookByAddressBookId(Long addressBookId);
|
||||
|
||||
/**
|
||||
* 查询地址簿列表
|
||||
*
|
||||
* @param addressBookPo 地址簿
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookList(AddressBookPo addressBookPo);
|
||||
|
||||
/**
|
||||
* 新增地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAddressBook(AddressBook addressBook);
|
||||
|
||||
/**
|
||||
* 修改地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAddressBook(AddressBook addressBook);
|
||||
|
||||
/**
|
||||
* 批量删除地址簿
|
||||
*
|
||||
* @param addressBookIds 需要删除的地址簿主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookIds(Long[] addressBookIds);
|
||||
|
||||
/**
|
||||
* 删除地址簿信息
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookId(Long addressBookId);
|
||||
|
||||
/**
|
||||
* 查询常用路线集合
|
||||
*
|
||||
* @param commonRoutePo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRoutePo commonRoutePo);
|
||||
|
||||
/**
|
||||
* 新增常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCommonRoute(CommonRoute commonRoute);
|
||||
|
||||
/**
|
||||
* 修改常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCommonRoute(CommonRoute commonRoute);
|
||||
|
||||
/**
|
||||
* 根据货单id查询地址簿列表
|
||||
*
|
||||
* @param manifestId 货单id
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookListByManifestId(Long manifestId);
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.facade;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.basic.domain.addressBook.todo.CommonRouteDo;
|
||||
|
||||
/**
|
||||
* 常用路线Service接口
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
public interface CommonRouteInterface extends IService<CommonRoute>
|
||||
{
|
||||
/**
|
||||
* 查询常用路线
|
||||
*
|
||||
* @param commonRouteId 常用路线主键
|
||||
* @return 常用路线
|
||||
*/
|
||||
public CommonRoutePo selectCommonRouteByCommonRouteId(Long commonRouteId);
|
||||
|
||||
/**
|
||||
* 查询常用路线列表
|
||||
*
|
||||
* @param commonRouteDo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRouteDo commonRouteDo);
|
||||
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.addressBook.entity.AddressBook;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.common.core.domain.po.AddressBookPo;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地址簿 数据层
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
public interface AddressBookMapper extends BaseMapper<AddressBook>
|
||||
{
|
||||
/**
|
||||
* 查询地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 地址簿
|
||||
*/
|
||||
public AddressBookPo selectAddressBookByAddressBookId(Long addressBookId);
|
||||
|
||||
/**
|
||||
* 查询地址簿列表
|
||||
*
|
||||
* @param addressBookPo 地址簿
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookList(AddressBookPo addressBookPo);
|
||||
|
||||
/**
|
||||
* 新增地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAddressBook(AddressBook addressBook);
|
||||
|
||||
/**
|
||||
* 修改地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAddressBook(AddressBook addressBook);
|
||||
|
||||
/**
|
||||
* 删除地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookId(Long addressBookId);
|
||||
|
||||
/**
|
||||
* 批量删除地址簿
|
||||
*
|
||||
* @param addressBookIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookIds(Long[] addressBookIds);
|
||||
|
||||
/**
|
||||
* 查询常用路线集合
|
||||
*
|
||||
* @param commonRoutePo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRoutePo commonRoutePo);
|
||||
|
||||
/**
|
||||
* 新增常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCommonRoute(CommonRoute commonRoute);
|
||||
|
||||
/**
|
||||
* 修改常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCommonRoute(CommonRoute commonRoute);
|
||||
|
||||
/**
|
||||
* 根据货单id查询地址簿列表
|
||||
*
|
||||
* @param manifestId 货单id
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookListByManifestId(Long manifestId);
|
||||
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.basic.domain.addressBook.todo.CommonRouteDo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 常用路线Mapper接口
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
public interface CommonRouteMapper extends BaseMapper<CommonRoute>
|
||||
{
|
||||
/**
|
||||
* 查询常用路线
|
||||
*
|
||||
* @param commonRouteId 常用路线主键
|
||||
* @return 常用路线
|
||||
*/
|
||||
public CommonRoutePo selectCommonRouteByCommonRouteId(@Param("commonRouteId") Long commonRouteId);
|
||||
|
||||
/**
|
||||
* 查询常用路线列表
|
||||
*
|
||||
* @param commonRouteDo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(@Param("commonRouteDo") CommonRouteDo commonRouteDo);
|
||||
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.addressBook.entity.AddressBook;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.basic.domain.addressBook.repository.facade.AddressBookRepositoryInterface;
|
||||
import com.mhd.basic.domain.addressBook.repository.mapper.AddressBookMapper;
|
||||
import com.mhd.common.core.domain.po.AddressBookPo;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 地址簿 业务层
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class AddressBookRepositoryImpl extends ServiceImpl<AddressBookMapper,AddressBook> implements AddressBookRepositoryInterface
|
||||
{
|
||||
@Autowired
|
||||
private AddressBookMapper addressBookMapper;
|
||||
|
||||
/**
|
||||
* 查询地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 地址簿
|
||||
*/
|
||||
@Override
|
||||
public AddressBookPo selectAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
return addressBookMapper.selectAddressBookByAddressBookId(addressBookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地址簿列表
|
||||
*
|
||||
* @param addressBookPo 地址簿
|
||||
* @return 地址簿
|
||||
*/
|
||||
@Override
|
||||
public List<AddressBookPo> selectAddressBookList(AddressBookPo addressBookPo)
|
||||
{
|
||||
return addressBookMapper.selectAddressBookList(addressBookPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAddressBook(AddressBook addressBook)
|
||||
{
|
||||
return addressBookMapper.insertAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAddressBook(AddressBook addressBook)
|
||||
{
|
||||
return addressBookMapper.updateAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地址簿
|
||||
*
|
||||
* @param addressBookIds 需要删除的地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAddressBookByAddressBookIds(Long[] addressBookIds)
|
||||
{
|
||||
return addressBookMapper.deleteAddressBookByAddressBookIds(addressBookIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址簿信息
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
return addressBookMapper.deleteAddressBookByAddressBookId(addressBookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线集合
|
||||
*
|
||||
* @param commonRoutePo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
@Override
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRoutePo commonRoutePo){
|
||||
return addressBookMapper.selectCommonRouteList(commonRoutePo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCommonRoute(CommonRoute commonRoute){
|
||||
return addressBookMapper.insertCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCommonRoute(CommonRoute commonRoute){
|
||||
return addressBookMapper.updateCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据货单id查询地址簿列表
|
||||
*
|
||||
* @param manifestId 货单id
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
@Override
|
||||
public List<AddressBookPo> selectAddressBookListByManifestId(Long manifestId){
|
||||
return addressBookMapper.selectAddressBookListByManifestId(manifestId);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.mhd.basic.domain.addressBook.repository.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.basic.domain.addressBook.repository.facade.CommonRouteInterface;
|
||||
import com.mhd.basic.domain.addressBook.repository.mapper.CommonRouteMapper;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.basic.domain.addressBook.todo.CommonRouteDo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 常用路线Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Service
|
||||
public class CommonRouteImpl extends ServiceImpl<CommonRouteMapper, CommonRoute> implements CommonRouteInterface
|
||||
{
|
||||
@Autowired
|
||||
private CommonRouteMapper commonRouteMapper;
|
||||
|
||||
/**
|
||||
* 查询常用路线
|
||||
*
|
||||
* @param commonRouteId 常用路线主键
|
||||
* @return 常用路线
|
||||
*/
|
||||
@Override
|
||||
public CommonRoutePo selectCommonRouteByCommonRouteId(Long commonRouteId)
|
||||
{
|
||||
return commonRouteMapper.selectCommonRouteByCommonRouteId(commonRouteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线列表
|
||||
*
|
||||
* @param commonRouteDo 常用路线
|
||||
* @return 常用路线
|
||||
*/
|
||||
@Override
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRouteDo commonRouteDo)
|
||||
{
|
||||
return commonRouteMapper.selectCommonRouteList(commonRouteDo);
|
||||
}
|
||||
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package com.mhd.basic.domain.addressBook.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.basic.domain.addressBook.entity.AddressBook;
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.basic.domain.addressBook.repository.persistence.AddressBookRepositoryImpl;
|
||||
import com.mhd.common.core.domain.po.AddressBookPo;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地址簿 防腐层
|
||||
*
|
||||
* 本层为防腐层,业务逻辑可在本层完成
|
||||
*
|
||||
* 2023-04-04
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
public class AddressBookDomainService
|
||||
{
|
||||
@Autowired
|
||||
private AddressBookRepositoryImpl addressBookRepositoryImpl;
|
||||
|
||||
/**
|
||||
* 查询地址簿
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 地址簿
|
||||
*/
|
||||
public AddressBookPo selectAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
return addressBookRepositoryImpl.selectAddressBookByAddressBookId(addressBookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地址簿列表
|
||||
*
|
||||
* @param addressBookPo 地址簿
|
||||
* @return 地址簿
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookList(AddressBookPo addressBookPo)
|
||||
{
|
||||
return addressBookRepositoryImpl.selectAddressBookList(addressBookPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAddressBook(AddressBook addressBook)
|
||||
{
|
||||
return addressBookRepositoryImpl.insertAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地址簿
|
||||
*
|
||||
* @param addressBook 地址簿
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAddressBook(AddressBook addressBook)
|
||||
{
|
||||
return addressBookRepositoryImpl.updateAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地址簿
|
||||
*
|
||||
* @param addressBookIds 需要删除的地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookIds(Long[] addressBookIds)
|
||||
{
|
||||
return addressBookRepositoryImpl.deleteAddressBookByAddressBookIds(addressBookIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址簿信息
|
||||
*
|
||||
* @param addressBookId 地址簿主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAddressBookByAddressBookId(Long addressBookId)
|
||||
{
|
||||
return addressBookRepositoryImpl.deleteAddressBookByAddressBookId(addressBookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线集合
|
||||
*
|
||||
* @param commonRoutePo 常用路线
|
||||
* @return 常用路线集合
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRoutePo commonRoutePo){
|
||||
return addressBookRepositoryImpl.selectCommonRouteList(commonRoutePo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCommonRoute(CommonRoute commonRoute){
|
||||
return addressBookRepositoryImpl.insertCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常用路线
|
||||
*
|
||||
* @param commonRoute 常用路线
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCommonRoute(CommonRoute commonRoute){
|
||||
return addressBookRepositoryImpl.updateCommonRoute(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据货单id查询地址簿列表
|
||||
*
|
||||
* @param manifestId 货单id
|
||||
* @return 地址簿集合
|
||||
*/
|
||||
public List<AddressBookPo> selectAddressBookListByManifestId(Long manifestId){
|
||||
return addressBookRepositoryImpl.selectAddressBookListByManifestId(manifestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址簿
|
||||
* @param addressBookId
|
||||
* @return
|
||||
*/
|
||||
public int deleteAddressBookById(Long addressBookId) {
|
||||
AddressBook addressBook = new AddressBook();
|
||||
addressBook.setAddressBookId(addressBookId);
|
||||
addressBook.setUpdateBy(SecurityUtils.getUserId());
|
||||
addressBook.setUpdateByName(SecurityUtils.getUsername());
|
||||
addressBook.setUpdateTime(new Date());
|
||||
addressBook.setDelFlag(2);
|
||||
return addressBookRepositoryImpl.updateAddressBook(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用lambda表达式做条件查询单个地址
|
||||
* @param queryWrapper 查询条件
|
||||
* @return
|
||||
*/
|
||||
public AddressBook selectOneByLambda(LambdaQueryWrapper<AddressBook> queryWrapper) {
|
||||
return addressBookRepositoryImpl.getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.mhd.basic.domain.addressBook.service;
|
||||
|
||||
import com.mhd.basic.domain.addressBook.entity.CommonRoute;
|
||||
import com.mhd.basic.domain.addressBook.repository.facade.CommonRouteInterface;
|
||||
import com.mhd.common.core.domain.po.CommonRoutePo;
|
||||
import com.mhd.basic.domain.addressBook.todo.CommonRouteDo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常用路线Service业务层处理
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Service
|
||||
public class CommonRouteDomainService
|
||||
{
|
||||
@Autowired
|
||||
private CommonRouteInterface commonRouteInterface;
|
||||
|
||||
/**
|
||||
* 查询常用路线
|
||||
*
|
||||
* @param commonRouteId 常用路线主键
|
||||
* @return 常用路线
|
||||
*/
|
||||
public CommonRoutePo selectCommonRouteByCommonRouteId(Long commonRouteId)
|
||||
{
|
||||
return commonRouteInterface.selectCommonRouteByCommonRouteId(commonRouteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询常用路线列表
|
||||
*
|
||||
* @param commonRouteDo 常用路线
|
||||
* @return 常用路线
|
||||
*/
|
||||
public List<CommonRoutePo> selectCommonRouteList(CommonRouteDo commonRouteDo)
|
||||
{
|
||||
return commonRouteInterface.selectCommonRouteList(commonRouteDo);
|
||||
}
|
||||
|
||||
public boolean insertCommonRoute(CommonRoute commonRoute) {
|
||||
return commonRouteInterface.save(commonRoute);
|
||||
}
|
||||
|
||||
public boolean updateCommonRoute(CommonRoute commonRoute) {
|
||||
return commonRouteInterface.updateById(commonRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除常用线路
|
||||
* @param commonRouteId
|
||||
* @return
|
||||
*/
|
||||
public boolean removeCommonRouteById(Long commonRouteId) {
|
||||
CommonRoute commonRoute = new CommonRoute();
|
||||
commonRoute.setCommonRouteId(commonRouteId);
|
||||
commonRoute.setUpdateBy(SecurityUtils.getUserId());
|
||||
commonRoute.setUpdateByName(SecurityUtils.getUsername());
|
||||
commonRoute.setUpdateTime(new Date());
|
||||
commonRoute.setDelFlag(2);
|
||||
return commonRouteInterface.updateById(commonRoute);
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.mhd.basic.domain.addressBook.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 常用路线对象 common_route
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Data
|
||||
public class CommonRouteDo extends BaseVOEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 常用路线id */
|
||||
@ApiModelProperty(name = "常用路线id")
|
||||
private Long commonRouteId;
|
||||
|
||||
/** 用户ID */
|
||||
@ApiModelProperty(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 发货地址簿id */
|
||||
@ApiModelProperty(name = "发货地址簿id")
|
||||
private Long sendAddressId;
|
||||
|
||||
/** 途径地地址簿id集合 */
|
||||
@ApiModelProperty(name = "途径地地址簿id集合")
|
||||
private String throughAddressId;
|
||||
|
||||
/** 收货地址簿id */
|
||||
@ApiModelProperty(name = "收货地址簿id")
|
||||
private Long receiveAddressId;
|
||||
|
||||
@ApiModelProperty("发货联系人")
|
||||
@Excel(name = "发货联系人")
|
||||
private String mailName;
|
||||
|
||||
@ApiModelProperty("发货联系方式")
|
||||
@Excel(name = "发货联系方式")
|
||||
private String mailPhone;
|
||||
|
||||
@ApiModelProperty("发货县区编码")
|
||||
@Excel(name = "发货县区编码")
|
||||
private Long mailCountyCode;
|
||||
|
||||
@ApiModelProperty("发货县区名称")
|
||||
@Excel(name = "发货县区名称")
|
||||
private String mailCountyName;
|
||||
|
||||
@ApiModelProperty("发货门牌信息")
|
||||
@Excel(name = "发货门牌信息")
|
||||
private String mailDoorplate;
|
||||
|
||||
/** 发货地址 */
|
||||
@ApiModelProperty(name = "发货地址")
|
||||
private String mailAddress;
|
||||
|
||||
/** 发货地址经度 */
|
||||
@ApiModelProperty(name = "发货地址经度")
|
||||
private String sendLongitude;
|
||||
|
||||
/** 发货地址纬度 */
|
||||
@ApiModelProperty(name = "发货地址纬度")
|
||||
private String sendLatitude;
|
||||
|
||||
@ApiModelProperty("收货联系人")
|
||||
@Excel(name = "收货联系人")
|
||||
private String addresseeName;
|
||||
|
||||
@ApiModelProperty("收货联系方式")
|
||||
@Excel(name = "收货联系方式")
|
||||
private String addresseePhone;
|
||||
|
||||
@ApiModelProperty("收货县区编码")
|
||||
@Excel(name = "收货县区编码")
|
||||
private Long addresseeCountyCode;
|
||||
|
||||
@ApiModelProperty("收货县区名称")
|
||||
@Excel(name = "收货县区名称")
|
||||
private String addresseeCountyName;
|
||||
|
||||
@ApiModelProperty("收货门牌信息")
|
||||
@Excel(name = "收货门牌信息")
|
||||
private String addresseeDoorplate;
|
||||
|
||||
/** 收货地址 */
|
||||
@ApiModelProperty(name = "收货地址")
|
||||
private String addresseeAddress;
|
||||
|
||||
/** 收货地址经度 */
|
||||
@ApiModelProperty(name = "收货地址经度")
|
||||
private String receiveLongitude;
|
||||
|
||||
/** 收货地址纬度 */
|
||||
@ApiModelProperty(name = "收货地址纬度")
|
||||
private String receiveLatitude;
|
||||
|
||||
@ApiModelProperty(name = "APP查询条件")
|
||||
private String synthesize;
|
||||
|
||||
@ApiModelProperty(name = "发货地址小区")
|
||||
private String mailAddressPlot;
|
||||
|
||||
@ApiModelProperty(name = "收货地址小区")
|
||||
private String addresseeAddressPlot;
|
||||
|
||||
@ApiModelProperty(name = "线路名称")
|
||||
private java.lang.String lineName;
|
||||
|
||||
@ApiModelProperty(name = "运距(千米)")
|
||||
private java.math.BigDecimal haulDistance;
|
||||
/** 发货单位名称 */
|
||||
@ApiModelProperty(name = "发货单位名称")
|
||||
private String sendUnitName;
|
||||
|
||||
/** 收货单位名称 */
|
||||
@ApiModelProperty(name = "收货单位名称")
|
||||
private String receiveUnitName;
|
||||
|
||||
@ApiModelProperty(name = "运费单价")
|
||||
private BigDecimal freightUnitPrice;
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.mhd.basic.domain.areaAggregate.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 城市信息表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/15 15:47
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_city")
|
||||
public class SysCityEntity extends BaseVOEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "城市表id")
|
||||
private Long cityId;
|
||||
@ApiModelProperty(name = "城市编码")
|
||||
private Long cityCode;
|
||||
@ApiModelProperty(name = "城市编码-最新")
|
||||
private Long cityCodeNew;
|
||||
@ApiModelProperty(name = "省编码")
|
||||
private Long provinceCode;
|
||||
@ApiModelProperty(name = "城市名称")
|
||||
private String cityName;
|
||||
@ApiModelProperty(name = "城市备注信息")
|
||||
private String cityRemark;
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.mhd.basic.domain.areaAggregate.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 区县信息表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/15 15:47
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_county")
|
||||
public class SysCountyEntity extends BaseVOEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "区县表id")
|
||||
private Long countyId;
|
||||
@ApiModelProperty(name = "区县编码")
|
||||
private Long countyCode;
|
||||
@ApiModelProperty(name = "区县编码-最新")
|
||||
private Long countyCodeNew;
|
||||
@ApiModelProperty(name = "区县名称")
|
||||
private String countyName;
|
||||
@ApiModelProperty(name = "城市编码")
|
||||
private Long cityCode;
|
||||
@ApiModelProperty(name = "区县备注信息")
|
||||
private String countyRemark;
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.mhd.basic.domain.areaAggregate.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 省份信息表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/15 15:47
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_province")
|
||||
public class SysProvinceEntity extends BaseVOEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "省份表id")
|
||||
private Long provinceId;
|
||||
@ApiModelProperty(name = "省份编码")
|
||||
private Long provinceCode;
|
||||
@ApiModelProperty(name = "省份名称")
|
||||
private String provinceName;
|
||||
@ApiModelProperty(name = "省份备注信息")
|
||||
private String provinceRemark;
|
||||
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.mhd.basic.domain.areaAggregate.factory;
|
||||
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCityEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysProvinceEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SysProvinceCityCountyFactory {
|
||||
|
||||
public SysProvinceEntity getProvinceEntity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
SysProvinceEntity sysProvinceEntity = new SysProvinceEntity();
|
||||
BeanUtils.copyProperties(sysProvinceDO, sysProvinceEntity, IgnoreNullUtil.getNullPropertyNames(sysProvinceDO));
|
||||
return sysProvinceEntity;
|
||||
}
|
||||
|
||||
public SysCityEntity getCityEntity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
SysCityEntity sysCityEntity = new SysCityEntity();
|
||||
BeanUtils.copyProperties(sysProvinceDO, sysCityEntity, IgnoreNullUtil.getNullPropertyNames(sysProvinceDO));
|
||||
return sysCityEntity;
|
||||
}
|
||||
|
||||
public SysCountyEntity getCountyEntity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
SysCountyEntity sysCountyEntity = new SysCountyEntity();
|
||||
BeanUtils.copyProperties(sysProvinceDO, sysCountyEntity, IgnoreNullUtil.getNullPropertyNames(sysProvinceDO));
|
||||
return sysCountyEntity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCityEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysProvinceEntity;
|
||||
import com.mhd.basic.domain.brand.entity.Brand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysProvinceCityCountyRepositoryInterface{
|
||||
|
||||
List<SysProvinceEntity> selectProvinceList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectProvinceAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectAllAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
List<SysAreaPO> selectBranchAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectSsqhList();
|
||||
|
||||
List<SysAreaPO> selectCityAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectCountyAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysProvinceEntity findProvinceById(Long provinceId);
|
||||
|
||||
SysProvinceEntity findProvinceByProvinceCode(Long provinceCode);
|
||||
|
||||
SysProvinceEntity addProvince(SysProvinceEntity sysProvinceEntity);
|
||||
|
||||
SysProvinceEntity updateProvince(SysProvinceEntity sysProvinceEntity);
|
||||
|
||||
List<SysCityEntity> selectCityList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysCityEntity findCityById(Long cityId);
|
||||
|
||||
SysCityEntity findCityByCityCode(Long cityCode);
|
||||
|
||||
SysCityEntity addCity(SysCityEntity sysCityEntity);
|
||||
|
||||
SysCityEntity updateCity(SysCityEntity sysCityEntity);
|
||||
|
||||
List<SysCountyEntity> selectCountyList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysCountyEntity findCountyById(Long countyId);
|
||||
|
||||
SysCountyEntity findCountyByCountyCode(Long countyCode);
|
||||
|
||||
SysCountyEntity addCounty(SysCountyEntity sysCountyEntity);
|
||||
|
||||
SysCountyEntity updateCounty(SysCountyEntity sysCountyEntity);
|
||||
|
||||
SysProvinceEntity findProvinceMaxCode();
|
||||
|
||||
SysCityEntity findCityMaxCode(Long provinceCode);
|
||||
|
||||
SysCountyEntity findCountyMaxCode(Long cityCode);
|
||||
|
||||
SysAreaPO findAreaInfo(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysAreaPO findAreaInfoByCityCode(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysAreaPO findAreaInfoByProvince(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
void deleteProvinceByCode(String code);
|
||||
|
||||
void deleteCityByCode(String code);
|
||||
|
||||
void deleteCountryByCode(String code);
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCityEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysCityMapper extends BaseMapper<SysCityEntity> {
|
||||
|
||||
List<SysCityEntity> selectList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectCityAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysCityEntity findById(Long cityId);
|
||||
|
||||
SysCityEntity findByCityCode(Long cityCode);
|
||||
|
||||
SysCityEntity findCityMaxCode(Long provinceCode);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysCountyMapper extends BaseMapper<SysCountyEntity> {
|
||||
|
||||
List<SysCountyEntity> selectList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectCountyAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysCountyEntity findById(Long countyId);
|
||||
|
||||
SysCountyEntity findByCountyCode(Long countyCode);
|
||||
|
||||
SysCountyEntity findCountyMaxCode(Long cityCode);
|
||||
|
||||
SysAreaPO findAreaInfo(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysAreaPO findAreaInfoByCityCode(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
SysAreaPO findAreaInfoByProvince(SysProvinceCityCountyDO sysProvinceDO);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysProvinceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysProvinceMapper extends BaseMapper<SysProvinceEntity> {
|
||||
|
||||
List<SysProvinceEntity> selectList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectProvinceAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectAllAreaList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
List<SysAreaPO> selectBranchAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO);
|
||||
|
||||
List<SysAreaPO> selectSsqhList();
|
||||
|
||||
SysProvinceEntity findById(Long provinceId);
|
||||
|
||||
SysProvinceEntity findByProvinceCode(Long provinceCode);
|
||||
|
||||
SysProvinceEntity findProvinceMaxCode();
|
||||
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCityEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysProvinceEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.facade.SysProvinceCityCountyRepositoryInterface;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.mapper.SysCityMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.mapper.SysCountyMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.mapper.SysProvinceMapper;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysProvinceCityCountyRepositoryImpl implements SysProvinceCityCountyRepositoryInterface {
|
||||
|
||||
@Resource
|
||||
private SysProvinceMapper sysProvinceMapper;
|
||||
@Resource
|
||||
private SysCityMapper sysCityMapper;
|
||||
@Resource
|
||||
private SysCountyMapper sysCountyMapper;
|
||||
|
||||
@Override
|
||||
public List<SysProvinceEntity> selectProvinceList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceMapper.selectList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysAreaPO> selectProvinceAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceMapper.selectProvinceAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysAreaPO> selectAllAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceMapper.selectAllAreaList(sysProvinceDO);
|
||||
}
|
||||
@Override
|
||||
public List<SysAreaPO> selectBranchAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceMapper.selectBranchAreaChildrenList(sysProvinceDO);
|
||||
}
|
||||
@Override
|
||||
public List<SysAreaPO> selectSsqhList() {
|
||||
return sysProvinceMapper.selectSsqhList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysAreaPO> selectCityAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCityMapper.selectCityAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysAreaPO> selectCountyAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCountyMapper.selectCountyAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysProvinceEntity findProvinceById(Long provinceId) {
|
||||
return sysProvinceMapper.findById(provinceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysProvinceEntity findProvinceByProvinceCode(Long provinceCode) {
|
||||
return sysProvinceMapper.findByProvinceCode(provinceCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysProvinceEntity addProvince(SysProvinceEntity sysProvinceEntity) {
|
||||
sysProvinceMapper.insert(sysProvinceEntity);
|
||||
return sysProvinceEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysProvinceEntity updateProvince(SysProvinceEntity sysProvinceEntity) {
|
||||
sysProvinceMapper.updateById(sysProvinceEntity);
|
||||
return sysProvinceEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysCityEntity> selectCityList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCityMapper.selectList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCityEntity findCityById(Long cityId) {
|
||||
return sysCityMapper.findById(cityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCityEntity findCityByCityCode(Long cityCode) {
|
||||
return sysCityMapper.findByCityCode(cityCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCityEntity addCity(SysCityEntity sysCityEntity) {
|
||||
sysCityMapper.insert(sysCityEntity);
|
||||
return sysCityEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCityEntity updateCity(SysCityEntity sysCityEntity) {
|
||||
sysCityMapper.updateById(sysCityEntity);
|
||||
return sysCityEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysCountyEntity> selectCountyList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCountyMapper.selectList(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCountyEntity findCountyById(Long countyId) {
|
||||
return sysCountyMapper.findById(countyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCountyEntity findCountyByCountyCode(Long countyCode) {
|
||||
return sysCountyMapper.findByCountyCode(countyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCountyEntity addCounty(SysCountyEntity sysCountyEntity) {
|
||||
sysCountyMapper.insert(sysCountyEntity);
|
||||
return sysCountyEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCountyEntity updateCounty(SysCountyEntity sysCountyEntity) {
|
||||
sysCountyMapper.updateById(sysCountyEntity);
|
||||
return sysCountyEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysProvinceEntity findProvinceMaxCode(){
|
||||
return sysProvinceMapper.findProvinceMaxCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCityEntity findCityMaxCode(Long provinceCode){
|
||||
return sysCityMapper.findCityMaxCode(provinceCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCountyEntity findCountyMaxCode(Long cityCode){
|
||||
return sysCountyMapper.findCountyMaxCode(cityCode);
|
||||
}
|
||||
@Override
|
||||
public SysAreaPO findAreaInfo(SysProvinceCityCountyDO sysProvinceDO){
|
||||
return sysCountyMapper.findAreaInfo(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysAreaPO findAreaInfoByCityCode(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCountyMapper.findAreaInfoByCityCode(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysAreaPO findAreaInfoByProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysCountyMapper.findAreaInfoByProvince(sysProvinceDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProvinceByCode(String code) {
|
||||
LambdaUpdateWrapper<SysProvinceEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SysProvinceEntity::getDelFlag,2);
|
||||
|
||||
updateWrapper.eq(SysProvinceEntity::getProvinceCode,code);
|
||||
updateWrapper.eq(SysProvinceEntity::getDelFlag,1);
|
||||
sysProvinceMapper.update(new SysProvinceEntity(),updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCityByCode(String code) {
|
||||
LambdaUpdateWrapper<SysCityEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SysCityEntity::getDelFlag,2);
|
||||
|
||||
updateWrapper.eq(SysCityEntity::getCityCode,code);
|
||||
updateWrapper.eq(SysCityEntity::getDelFlag,1);
|
||||
sysCityMapper.update(new SysCityEntity(),updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCountryByCode(String code) {
|
||||
LambdaUpdateWrapper<SysCountyEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SysCountyEntity::getDelFlag,2);
|
||||
|
||||
updateWrapper.eq(SysCountyEntity::getCountyCode,code);
|
||||
updateWrapper.eq(SysCountyEntity::getDelFlag,1);
|
||||
sysCountyMapper.update(new SysCountyEntity(),updateWrapper);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysAreaPO {
|
||||
@ApiModelProperty(name = "areaId")
|
||||
private String areaId="";
|
||||
@ApiModelProperty(name = "parentAreaCode")
|
||||
private Long parentAreaCode = 0L;
|
||||
@ApiModelProperty(name = "编码")
|
||||
private Long areaCode = 0L;
|
||||
@ApiModelProperty(name = "编码-最新")
|
||||
private Long areaCodeNew = 0L;
|
||||
@ApiModelProperty(name = "名称")
|
||||
private String areaName = "";
|
||||
@ApiModelProperty(name = "备注信息")
|
||||
private String areaRemark = "";
|
||||
@ApiModelProperty(name = "省市县名称")
|
||||
private String provinceCityCountyName = "";
|
||||
|
||||
@ApiModelProperty(name = "省")
|
||||
private String provinceName = "";
|
||||
@ApiModelProperty(name = "市")
|
||||
private String cityName = "";
|
||||
@ApiModelProperty(name = "县区")
|
||||
private String countyName = "";
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.po;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysProvinceCityCountyPO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "省份表id")
|
||||
private Long provinceId;
|
||||
@ApiModelProperty(name = "省份编码")
|
||||
private Long provinceCode;
|
||||
@ApiModelProperty(name = "省份名称")
|
||||
private String provinceName;
|
||||
@ApiModelProperty(name = "省份备注信息")
|
||||
private String provinceRemark;
|
||||
|
||||
@ApiModelProperty(name = "城市表id")
|
||||
private Long cityId;
|
||||
@ApiModelProperty(name = "城市编码")
|
||||
private Long cityCode;
|
||||
@ApiModelProperty(name = "城市编码-最新")
|
||||
private Long cityCodeNew;
|
||||
@ApiModelProperty(name = "城市名称")
|
||||
private String cityName;
|
||||
@ApiModelProperty(name = "城市备注信息")
|
||||
private String cityRemark;
|
||||
|
||||
@ApiModelProperty(name = "区县表id")
|
||||
private Long countyId;
|
||||
@ApiModelProperty(name = "区县编码")
|
||||
private Long countyCode;
|
||||
@ApiModelProperty(name = "区县编码-最新")
|
||||
private Long countyCodeNew;
|
||||
@ApiModelProperty(name = "区县名称")
|
||||
private String countyName;
|
||||
@ApiModelProperty(name = "区县备注信息")
|
||||
private String countyRemark;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.mhd.basic.domain.areaAggregate.repository.todo;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SysProvinceCityCountyDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "省份表id")
|
||||
private Long provinceId;
|
||||
@ApiModelProperty(name = "省份编码")
|
||||
private Long provinceCode;
|
||||
@ApiModelProperty(name = "省份名称")
|
||||
private String provinceName;
|
||||
@ApiModelProperty(name = "省份备注信息")
|
||||
private String provinceRemark;
|
||||
|
||||
@ApiModelProperty(name = "城市表id")
|
||||
private Long cityId;
|
||||
@ApiModelProperty(name = "城市编码")
|
||||
private Long cityCode;
|
||||
@ApiModelProperty(name = "城市编码-最新")
|
||||
private Long cityCodeNew;
|
||||
@ApiModelProperty(name = "城市名称")
|
||||
private String cityName;
|
||||
@ApiModelProperty(name = "城市备注信息")
|
||||
private String cityRemark;
|
||||
|
||||
@ApiModelProperty(name = "区县表id")
|
||||
private Long countyId;
|
||||
@ApiModelProperty(name = "区县编码")
|
||||
private Long countyCode;
|
||||
@ApiModelProperty(name = "区县编码-最新")
|
||||
private Long countyCodeNew;
|
||||
@ApiModelProperty(name = "区县名称")
|
||||
private String countyName;
|
||||
@ApiModelProperty(name = "区县备注信息")
|
||||
private String countyRemark;
|
||||
|
||||
@ApiModelProperty(name = "区县编码集合")
|
||||
private List<Long> countyCodes;
|
||||
@ApiModelProperty(name = "查询条件名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
+366
@@ -0,0 +1,366 @@
|
||||
package com.mhd.basic.domain.areaAggregate.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.google.common.base.Strings;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCityEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.entity.SysProvinceEntity;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.facade.SysProvinceCityCountyRepositoryInterface;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
|
||||
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
|
||||
import com.mhd.basic.domain.areaAggregate.factory.SysProvinceCityCountyFactory;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysProvinceCityCountyDomainService {
|
||||
|
||||
@Autowired
|
||||
private SysProvinceCityCountyFactory sysProvinceFactory;
|
||||
@Resource
|
||||
private SysProvinceCityCountyRepositoryInterface sysProvinceRepositoryInterface;
|
||||
|
||||
|
||||
public List<SysProvinceEntity> selectProvinceList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectProvinceList(sysProvinceDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增省
|
||||
* @Author Alex
|
||||
* @Date 2022/12/21 16:56
|
||||
*/
|
||||
public SysProvinceEntity addProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if(ObjectUtil.isNotNull(sysProvinceDO.getProvinceId())){
|
||||
return updateProvince(sysProvinceDO);
|
||||
}else {
|
||||
SysProvinceEntity sysProvinceEntity = sysProvinceFactory.getProvinceEntity(sysProvinceDO);
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysProvinceEntity sysProvinceEntityDB = sysProvinceRepositoryInterface.findProvinceByProvinceCode(sysProvinceDO.getProvinceCode());
|
||||
//查询当前省份code最大的省份
|
||||
SysProvinceEntity sysProvince = sysProvinceRepositoryInterface.findProvinceMaxCode();
|
||||
if (ObjectUtil.isNotNull(sysProvinceEntityDB)) {
|
||||
throw new ServiceException("该省份编码【" + sysProvinceDO.getProvinceCode() + "】已存在!");
|
||||
}
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysProvinceEntity.setCreateBy(loginUser.getUserid());
|
||||
sysProvinceEntity.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
//判断当前是否有省
|
||||
// if (sysProvince != null) {
|
||||
// sysProvinceEntity.setProvinceCode(sysProvince.getProvinceCode() + new Long("1"));
|
||||
// } else {
|
||||
// sysProvinceEntity.setProvinceCode(new Long("11"));
|
||||
// }
|
||||
sysProvinceEntity.setCreateTime(new Date());
|
||||
sysProvinceEntity.setDelFlag(1);
|
||||
return sysProvinceRepositoryInterface.addProvince(sysProvinceEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public SysProvinceEntity updateProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getProvinceId())) {
|
||||
throw new ServiceException("省份id不存在!");
|
||||
}
|
||||
SysProvinceEntity sysProvinceEntity = sysProvinceFactory.getProvinceEntity(sysProvinceDO);
|
||||
SysProvinceEntity sysProvinceEntityDBa = sysProvinceRepositoryInterface.findProvinceById(sysProvinceDO.getProvinceId());
|
||||
if (ObjectUtil.isNull(sysProvinceEntityDBa)) {
|
||||
throw new ServiceException("省份不存在!");
|
||||
} else {
|
||||
SysProvinceEntity sysProvinceEntityDBb = sysProvinceRepositoryInterface.findProvinceByProvinceCode(sysProvinceDO.getProvinceCode());
|
||||
if (ObjectUtil.isNotNull(sysProvinceEntityDBb) && !sysProvinceEntityDBb.getProvinceId().equals(sysProvinceDO.getProvinceId())) {
|
||||
throw new ServiceException("该省份编码【" + sysProvinceDO.getProvinceCode() + "】已存在!");
|
||||
}
|
||||
}
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysProvinceEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysProvinceEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
sysProvinceEntity.setUpdateTime(new Date());
|
||||
return sysProvinceRepositoryInterface.updateProvince(sysProvinceEntity);
|
||||
}
|
||||
|
||||
public int deleteProvinceByIds(List<Long> ids) {
|
||||
for (Long provinceId : ids) {
|
||||
SysProvinceEntity sysProvinceEntity = sysProvinceRepositoryInterface.findProvinceById(provinceId);
|
||||
if (ObjectUtil.isNotNull(sysProvinceEntity)) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysProvinceEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysProvinceEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
sysProvinceEntity.setDelFlag(2);
|
||||
sysProvinceEntity.setUpdateTime(new Date());
|
||||
sysProvinceRepositoryInterface.updateProvince(sysProvinceEntity);
|
||||
}
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
public List<SysCityEntity> selectCityList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectCityList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysCityEntity addCity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getProvinceCode())
|
||||
|| ObjectUtil.isNull(sysProvinceDO.getCityCode())
|
||||
|| Strings.isNullOrEmpty(sysProvinceDO.getCityName())) {
|
||||
throw new ServiceException("必填信息不允许为空!");
|
||||
}
|
||||
if (ObjectUtil.isNotNull(sysProvinceDO.getCityId())) {
|
||||
return updateCity(sysProvinceDO);
|
||||
} else {
|
||||
SysProvinceEntity sysProvinceEntity = sysProvinceRepositoryInterface.findProvinceByProvinceCode(sysProvinceDO.getProvinceCode());
|
||||
if (ObjectUtil.isNull(sysProvinceEntity)) {
|
||||
throw new ServiceException("省份编码" + sysProvinceDO.getProvinceCode() + "不存在!");
|
||||
}
|
||||
SysCityEntity sysCityEntity = sysProvinceFactory.getCityEntity(sysProvinceDO);
|
||||
sysCityEntity.setProvinceCode(new Long(sysProvinceDO.getProvinceCode()));
|
||||
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysCityEntity sysCityEntityDB = sysProvinceRepositoryInterface.findCityByCityCode(sysProvinceDO.getCityCode());
|
||||
//查询当前省份下的城市code最大的城市
|
||||
// SysCityEntity sysCity = sysProvinceRepositoryInterface.findCityMaxCode(new Long(sysProvinceDO.getProvinceCode()));
|
||||
if (ObjectUtil.isNotNull(sysCityEntityDB)) {
|
||||
throw new ServiceException("该城市编码【" + sysProvinceDO.getCityCode() + "】已存在!");
|
||||
}
|
||||
if (ObjectUtil.isNull(sysCityEntity.getCityCodeNew())) {
|
||||
sysCityEntity.setCityCodeNew(sysCityEntity.getCityCode());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCityEntity.setCreateBy(loginUser.getUserid());
|
||||
sysCityEntity.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
/* //判断当前省份下的城市是否存在
|
||||
if(sysCity != null){
|
||||
sysCityEntity.setCityCode(sysCity.getCityCode()+new Long("1"));
|
||||
sysCityEntity.setCityCodeNew(sysCity.getCityCode()+new Long("1"));
|
||||
}else {
|
||||
sysCityEntity.setCityCode(new Long(sysCity.getCityCode()+"01"));
|
||||
sysCityEntity.setCityCodeNew(new Long(sysCity.getCityCode()+"01"));
|
||||
}*/
|
||||
sysCityEntity.setCreateTime(new Date());
|
||||
sysCityEntity.setDelFlag(1);
|
||||
return sysProvinceRepositoryInterface.addCity(sysCityEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public SysCityEntity updateCity(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getProvinceCode())) {
|
||||
throw new ServiceException("省份编码不存在!");
|
||||
}
|
||||
SysProvinceEntity sysProvinceEntity = sysProvinceRepositoryInterface.findProvinceByProvinceCode(sysProvinceDO.getProvinceCode());
|
||||
if (ObjectUtil.isNull(sysProvinceEntity)) {
|
||||
throw new ServiceException("省份编码【" + sysProvinceDO.getProvinceCode() + "】不存在!");
|
||||
}
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getCityId())) {
|
||||
throw new ServiceException("城市id不存在!");
|
||||
}
|
||||
SysCityEntity sysCityEntity = sysProvinceFactory.getCityEntity(sysProvinceDO);
|
||||
SysCityEntity sysCityEntityDBa = sysProvinceRepositoryInterface.findCityById(sysProvinceDO.getCityId());
|
||||
if (ObjectUtil.isNull(sysCityEntityDBa)) {
|
||||
throw new ServiceException("城市不存在!");
|
||||
} else {
|
||||
SysCityEntity sysCityEntityDBb = sysProvinceRepositoryInterface.findCityByCityCode(sysProvinceDO.getCityCode());
|
||||
if (ObjectUtil.isNotNull(sysCityEntityDBb) && !sysCityEntityDBb.getCityId().equals(sysProvinceDO.getCityId())) {
|
||||
throw new ServiceException("该城市编码【" + sysProvinceDO.getCityCode() + "】已存在!");
|
||||
}
|
||||
}
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCityEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysCityEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
sysCityEntity.setUpdateTime(new Date());
|
||||
return sysProvinceRepositoryInterface.updateCity(sysCityEntity);
|
||||
}
|
||||
|
||||
public int deleteCityByIds(List<Long> ids) {
|
||||
for (Long cityId : ids) {
|
||||
SysCityEntity sysCityEntity = sysProvinceRepositoryInterface.findCityById(cityId);
|
||||
if (ObjectUtil.isNotNull(sysCityEntity)) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCityEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysCityEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
sysCityEntity.setDelFlag(2);
|
||||
sysCityEntity.setUpdateTime(new Date());
|
||||
sysProvinceRepositoryInterface.updateCity(sysCityEntity);
|
||||
}
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
public List<SysCountyEntity> selectCountyList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectCountyList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysCountyEntity addCounty(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getCityCode())
|
||||
|| ObjectUtil.isNull(sysProvinceDO.getCountyCode())
|
||||
|| Strings.isNullOrEmpty(sysProvinceDO.getCountyName())) {
|
||||
throw new ServiceException("必填信息不允许为空!");
|
||||
}
|
||||
if (ObjectUtil.isNotNull(sysProvinceDO.getCountyId())) {
|
||||
return updateCounty(sysProvinceDO);
|
||||
} else {
|
||||
SysCountyEntity sysCountyEntity = sysProvinceFactory.getCountyEntity(sysProvinceDO);
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysCountyEntity sysCountyEntityDB = sysProvinceRepositoryInterface.findCountyByCountyCode(sysProvinceDO.getCountyCode());
|
||||
if (ObjectUtil.isNotNull(sysCountyEntityDB)) {
|
||||
throw new ServiceException("该区县编码【" + sysProvinceDO.getCountyCode() + "】已存在!");
|
||||
}
|
||||
if(ObjectUtil.isNull(sysCountyEntity.getCountyCodeNew())){
|
||||
sysCountyEntity.setCountyCodeNew(sysCountyEntity.getCountyCode());
|
||||
}
|
||||
//查询当前城市下的县区code最大的县区
|
||||
// SysCountyEntity sysCounty = sysProvinceRepositoryInterface.findCountyMaxCode(new Long(sysProvinceDO.getCityCode()));
|
||||
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCountyEntity.setCreateBy(loginUser.getUserid());
|
||||
sysCountyEntity.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
//判断当前省份下的城市是否存在
|
||||
/*if (sysCounty != null) {
|
||||
sysCountyEntity.setCountyCode(sysCounty.getCountyCode() + new Long("1"));
|
||||
sysCountyEntity.setCountyCodeNew(sysCounty.getCountyCode() + new Long("1"));
|
||||
} else {
|
||||
sysCountyEntity.setCountyCode(new Long(sysCounty.getCountyCode() + "01"));
|
||||
sysCountyEntity.setCountyCodeNew(new Long(sysCounty.getCountyCode() + "01"));
|
||||
}*/
|
||||
sysCountyEntity.setCreateTime(new Date());
|
||||
sysCountyEntity.setDelFlag(1);
|
||||
return sysProvinceRepositoryInterface.addCounty(sysCountyEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public SysCountyEntity updateCounty(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getCityCode())) {
|
||||
throw new ServiceException("城市编码不存在!");
|
||||
}
|
||||
SysCityEntity sysCityEntity = sysProvinceRepositoryInterface.findCityByCityCode(sysProvinceDO.getCityCode());
|
||||
if (ObjectUtil.isNull(sysCityEntity)) {
|
||||
throw new ServiceException("城市编码【" + sysProvinceDO.getCityCode() + "】不存在!");
|
||||
}
|
||||
if (ObjectUtil.isNull(sysProvinceDO.getCountyId())) {
|
||||
throw new ServiceException("区县id不存在!");
|
||||
}
|
||||
SysCountyEntity sysCountyEntity = sysProvinceFactory.getCountyEntity(sysProvinceDO);
|
||||
SysCountyEntity sysCountyEntityDBa = sysProvinceRepositoryInterface.findCountyById(sysProvinceDO.getCountyId());
|
||||
if (ObjectUtil.isNull(sysCountyEntityDBa)) {
|
||||
throw new ServiceException("区县不存在!");
|
||||
} else {
|
||||
SysCountyEntity sysCountyEntityDBb = sysProvinceRepositoryInterface.findCountyByCountyCode(sysProvinceDO.getCountyCode());
|
||||
if (ObjectUtil.isNotNull(sysCountyEntityDBb) && !sysCountyEntityDBb.getCountyId().equals(sysProvinceDO.getCountyId())) {
|
||||
throw new ServiceException("该区县编码【" + sysProvinceDO.getCountyCode() + "】已存在!");
|
||||
}
|
||||
}
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCountyEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysCountyEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
sysCountyEntity.setUpdateTime(new Date());
|
||||
return sysProvinceRepositoryInterface.updateCounty(sysCountyEntity);
|
||||
}
|
||||
|
||||
public int deleteCountyByIds(List<String> ids) {
|
||||
for (String cityId : ids) {
|
||||
if (ObjectUtil.isNull(cityId)) {
|
||||
throw new ServiceException("区县id不允许为空!");
|
||||
}
|
||||
Long cityIdLong = Long.valueOf(cityId);
|
||||
SysCountyEntity sysCountyEntity = sysProvinceRepositoryInterface.findCountyById(cityIdLong);
|
||||
if (ObjectUtil.isNotNull(sysCountyEntity)) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
sysCountyEntity.setUpdateBy(loginUser.getUserid());
|
||||
sysCountyEntity.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
sysCountyEntity.setDelFlag(2);
|
||||
sysCountyEntity.setUpdateTime(new Date());
|
||||
sysProvinceRepositoryInterface.updateCounty(sysCountyEntity);
|
||||
}
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
|
||||
public List<SysAreaPO> selectProvinceAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectProvinceAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public List<SysAreaPO> selectCityAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectCityAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public List<SysAreaPO> selectCountyAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectCountyAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public List<SysAreaPO> selectAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectAllAreaList(sysProvinceDO);
|
||||
}
|
||||
public List<SysAreaPO> selectBranchAreaChildrenList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectBranchAreaChildrenList(sysProvinceDO);
|
||||
}
|
||||
public List<SysAreaPO> selectSsqhList() {
|
||||
return sysProvinceRepositoryInterface.selectSsqhList();
|
||||
}
|
||||
|
||||
public List<SysAreaPO> selectAllAreaList(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.selectAllAreaList(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfo(SysProvinceCityCountyDO sysProvinceDO){
|
||||
return sysProvinceRepositoryInterface.findAreaInfo(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfoByCityCode(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.findAreaInfoByCityCode(sysProvinceDO);
|
||||
}
|
||||
|
||||
public SysAreaPO findAreaInfoByProvince(SysProvinceCityCountyDO sysProvinceDO) {
|
||||
return sysProvinceRepositoryInterface.findAreaInfoByProvince(sysProvinceDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code删除省份
|
||||
*/
|
||||
public void deleteprovinceByCode(String code) {
|
||||
sysProvinceRepositoryInterface.deleteProvinceByCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code删除市
|
||||
*/
|
||||
public void deleteCityByCode(String code) {
|
||||
sysProvinceRepositoryInterface.deleteCityByCode(code);
|
||||
}
|
||||
|
||||
public void deleteCountryByCode(String code) {
|
||||
sysProvinceRepositoryInterface.deleteCountryByCode(code);
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 关联仓库对象 association_warehouse
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AssociationWarehouse extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("关联仓库id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long associationWarehouseId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("关联ID(组织或员工用户ID)")
|
||||
@Excel(name = "关联ID(组织或员工用户ID)")
|
||||
private Long correlationId;
|
||||
|
||||
@ApiModelProperty("是否默认仓库: 1-否 2-是 ")
|
||||
@Excel(name = "是否默认仓库: 1-否 2-是 ")
|
||||
private Integer isDefault;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
@Excel(name = "仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.po.AssociationWarehousePO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 关联仓库Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
public interface IAssociationWarehouseService extends IService<AssociationWarehouse>
|
||||
{
|
||||
/**
|
||||
* 分页查询关联仓库列表
|
||||
*/
|
||||
public List<AssociationWarehousePO> queryList(AssociationWarehouseDO associationWarehouseDO);
|
||||
|
||||
/**
|
||||
* 新增关联仓库
|
||||
*/
|
||||
public Boolean associationWarehouse(AssociationWarehouseDO associationWarehouseDO);
|
||||
|
||||
/**
|
||||
* 批量删除关联仓库
|
||||
*/
|
||||
public Boolean delete(Long[] associationWarehouseIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询关联仓库
|
||||
*/
|
||||
public AssociationWarehousePO getInfo(Long associationWarehouseId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.po.AssociationWarehousePO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 关联仓库Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
public interface AssociationWarehouseMapper extends BaseMapper<AssociationWarehouse>
|
||||
{
|
||||
/**
|
||||
* 查询关联仓库列表
|
||||
*/
|
||||
public List<AssociationWarehousePO> queryList(AssociationWarehouseDO associationWarehouseDO);
|
||||
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.facade.IAssociationWarehouseService;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.mapper.AssociationWarehouseMapper;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.po.AssociationWarehousePO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
import com.mhd.basic.domain.warehouse.entity.Warehouse;
|
||||
import com.mhd.basic.domain.warehouse.repository.mapper.WarehouseMapper;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 关联仓库Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
@Service
|
||||
public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMapper, AssociationWarehouse> implements IAssociationWarehouseService{
|
||||
@Autowired
|
||||
private AssociationWarehouseMapper associationWarehouseMapper;
|
||||
@Autowired
|
||||
private WarehouseMapper warehouseMapper;
|
||||
|
||||
/**
|
||||
* 查询关联仓库列表
|
||||
*/
|
||||
@Override
|
||||
public List<AssociationWarehousePO> queryList(AssociationWarehouseDO associationWarehouseDO)
|
||||
{
|
||||
return associationWarehouseMapper.queryList(associationWarehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增关联仓库
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean associationWarehouse(AssociationWarehouseDO associationWarehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
List<AssociationWarehouse> associationWarehouseList = new ArrayList<>();
|
||||
//批量绑定
|
||||
if(null != associationWarehouseDO.getIsBatch() && associationWarehouseDO.getIsBatch() == 1){
|
||||
if(CollectionUtils.isEmpty(associationWarehouseDO.getWarehouseIdIdList())){
|
||||
throw new ServiceException("请选择绑定仓库!");
|
||||
}
|
||||
if(CollectionUtils.isEmpty(associationWarehouseDO.getCorrelationIdList())){
|
||||
throw new ServiceException("请选择绑定人员!");
|
||||
}
|
||||
//首先根据要绑定的仓库id集合查询已经绑定的数据
|
||||
List<AssociationWarehouse> associationWarehouses = associationWarehouseMapper.selectList(new QueryWrapper<AssociationWarehouse>().lambda().in(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseIdIdList()));
|
||||
// 根据仓库id进行分组,为下面比较新增做准备
|
||||
Map<Long, List<Long>> correlationIdGroupMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(associationWarehouses)) {
|
||||
correlationIdGroupMap = associationWarehouses.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
AssociationWarehouse::getWarehouseId,
|
||||
Collectors.mapping(AssociationWarehouse::getCorrelationId, Collectors.toList())
|
||||
));
|
||||
}
|
||||
//循环所有仓库id
|
||||
for (Long warehouseIdId : associationWarehouseDO.getWarehouseIdIdList()){
|
||||
List<Long> correlationIdList = associationWarehouseDO.getCorrelationIdList();
|
||||
//移除已经绑定的人员
|
||||
List<Long> removedCorrelationIds = correlationIdGroupMap.get(warehouseIdId);
|
||||
if(!CollectionUtils.isEmpty(removedCorrelationIds)){
|
||||
correlationIdList.removeAll(removedCorrelationIds);
|
||||
}
|
||||
for (Long correlationId : correlationIdList){
|
||||
AssociationWarehouse associationWarehouse = new AssociationWarehouse();
|
||||
associationWarehouse.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
associationWarehouse.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
associationWarehouse.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
associationWarehouse.setCorrelationId(correlationId);
|
||||
//设置仓库信息
|
||||
associationWarehouseDO.setWarehouseId(warehouseIdId);
|
||||
warehouseParam(associationWarehouseDO);
|
||||
associationWarehouse.setWarehouseId(associationWarehouseDO.getWarehouseId());
|
||||
associationWarehouse.setWarehouseCode(associationWarehouseDO.getWarehouseCode());
|
||||
associationWarehouse.setWarehouseName(associationWarehouseDO.getWarehouseName());
|
||||
associationWarehouse.setCreateBy(loginUser.getUserid());
|
||||
associationWarehouse.setCreateByName(loginUser.getUsername());
|
||||
associationWarehouse.setCreateTime(new Date());
|
||||
associationWarehouseList.add(associationWarehouse);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//单个仓库
|
||||
List<Long> warehouseIdIdList = associationWarehouseDO.getWarehouseIdIdList();
|
||||
if(CollectionUtils.isEmpty(warehouseIdIdList) || associationWarehouseDO.getWarehouseIdIdList().size() != 1){
|
||||
throw new ServiceException("请正确选择绑定仓库!");
|
||||
}
|
||||
associationWarehouseDO.setWarehouseId(associationWarehouseDO.getWarehouseIdIdList().get(0));
|
||||
//设置仓库信息
|
||||
warehouseParam(associationWarehouseDO);
|
||||
for (Long correlationId : associationWarehouseDO.getCorrelationIdList()){
|
||||
AssociationWarehouse associationWarehouse = new AssociationWarehouse();
|
||||
associationWarehouse.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
associationWarehouse.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
associationWarehouse.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
associationWarehouse.setCorrelationId(correlationId);
|
||||
associationWarehouse.setWarehouseId(associationWarehouseDO.getWarehouseId());
|
||||
associationWarehouse.setWarehouseCode(associationWarehouseDO.getWarehouseCode());
|
||||
associationWarehouse.setWarehouseName(associationWarehouseDO.getWarehouseName());
|
||||
associationWarehouse.setCreateBy(loginUser.getUserid());
|
||||
associationWarehouse.setCreateByName(loginUser.getUsername());
|
||||
associationWarehouse.setCreateTime(new Date());
|
||||
associationWarehouseList.add(associationWarehouse);
|
||||
}
|
||||
//标记删除
|
||||
remove(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId()));
|
||||
}
|
||||
return saveBatch(associationWarehouseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除关联仓库
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] associationWarehouseIds ) {
|
||||
List<AssociationWarehouse> list = new ArrayList<>();
|
||||
for (Long id : associationWarehouseIds) {
|
||||
AssociationWarehouse associationWarehouse = new AssociationWarehouse();
|
||||
associationWarehouse.setAssociationWarehouseId(id);
|
||||
associationWarehouse.setDelFlag(2);
|
||||
list.add(associationWarehouse);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改关联仓库
|
||||
*/
|
||||
@Override
|
||||
public AssociationWarehousePO getInfo(Long associationWarehouseId) {
|
||||
AssociationWarehouse associationWarehouse = this.getById(associationWarehouseId);
|
||||
AssociationWarehousePO associationWarehousePO = new AssociationWarehousePO();
|
||||
BeanUtils.copyProperties(associationWarehouse,associationWarehousePO);
|
||||
return associationWarehousePO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 封装仓库信息
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 20:28
|
||||
* @param associationWarehouseDO
|
||||
*/
|
||||
private void warehouseParam(AssociationWarehouseDO associationWarehouseDO){
|
||||
Warehouse warehouseDb = warehouseMapper.selectOne(new QueryWrapper<Warehouse>().lambda()
|
||||
.in(Warehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(Warehouse::getDelFlag, 1));
|
||||
if (warehouseDb == null){
|
||||
throw new ServiceException("仓库信息不存在");
|
||||
}
|
||||
associationWarehouseDO.setWarehouseId(warehouseDb.getWarehouseId());
|
||||
associationWarehouseDO.setWarehouseCode(warehouseDb.getWarehouseCode());
|
||||
associationWarehouseDO.setWarehouseName(warehouseDb.getWarehouseName());
|
||||
}
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 关联仓库对象 association_warehouse
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "关联仓库对象", description = "关联仓库响应对象")
|
||||
public class AssociationWarehousePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("关联仓库id")
|
||||
private Long associationWarehouseId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("关联ID(组织或员工用户ID)")
|
||||
@Excel(name = "关联ID(组织或员工用户ID)")
|
||||
private Long correlationId;
|
||||
|
||||
@ApiModelProperty("是否默认仓库: 1-否 2-是 ")
|
||||
@Excel(name = "是否默认仓库: 1-否 2-是 ")
|
||||
private Integer isDefault;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
@Excel(name = "仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 关联仓库对象 association_warehouse
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AssociationWarehouseDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("关联仓库id")
|
||||
private Long associationWarehouseId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("关联ID(组织或员工用户ID)")
|
||||
@Excel(name = "关联ID(组织或员工用户ID)")
|
||||
private Long correlationId;
|
||||
|
||||
@ApiModelProperty("是否默认仓库: 1-否 2-是 ")
|
||||
@Excel(name = "是否默认仓库: 1-否 2-是 ")
|
||||
private Integer isDefault;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
@Excel(name = "仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
@Excel(name = "仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty(name = "关联仓库id集合")
|
||||
private List<Long> warehouseIdIdList;
|
||||
|
||||
@ApiModelProperty(name = "关联用户id集合")
|
||||
private List<Long> correlationIdList;
|
||||
|
||||
@ApiModelProperty("是否批量: 1-是 2-否 ")
|
||||
@Excel(name = "是否批量: 1-是 2-否 ")
|
||||
private Integer isBatch;
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.mhd.basic.domain.associationWarehouse.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.mhd.basic.domain.common.cache.AssociationWarehouseCacheUtil;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.facade.IAssociationWarehouseService;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.po.AssociationWarehousePO;
|
||||
import com.mhd.basic.domain.associationWarehouse.repository.todo.AssociationWarehouseDO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 关联仓库
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AssociationWarehouseDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAssociationWarehouseService associationWarehouseService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询关联仓库列表
|
||||
*/
|
||||
public List<AssociationWarehousePO> queryList(AssociationWarehouseDO associationWarehouseDO) {
|
||||
return associationWarehouseService.queryList(associationWarehouseDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增关联仓库
|
||||
*/
|
||||
public Boolean associationWarehouse(AssociationWarehouseDO associationWarehouseDO) {
|
||||
|
||||
return associationWarehouseService.associationWarehouse(associationWarehouseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除关联仓库
|
||||
*/
|
||||
public Boolean delete(Long[] associationWarehouseIds) {
|
||||
return associationWarehouseService.delete(associationWarehouseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联仓库详细信息
|
||||
*/
|
||||
public AssociationWarehousePO getInfo(Long associationWarehouseId)
|
||||
{
|
||||
return associationWarehouseService.getInfo(associationWarehouseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 切换仓库
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/11 15:34
|
||||
* @param associationWarehouseDO
|
||||
* @return List<AssociationWarehousePO>
|
||||
*/
|
||||
public AssociationWarehouseCacheDO setWarehouseInfo(AssociationWarehouseDO associationWarehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AssociationWarehouse associationWarehouse = associationWarehouseService.getOne(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||
if (ObjectUtil.isNull(associationWarehouse)){
|
||||
throw new ServiceException("用户关联仓库不存在");
|
||||
}
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
|
||||
BeanUtils.copyProperties(associationWarehouse, associationWarehouseCacheDO);
|
||||
//将之前默认仓库置空
|
||||
associationWarehouseService.update(null, new UpdateWrapper<AssociationWarehouse>().lambda()
|
||||
.set(AssociationWarehouse::getIsDefault, 1)
|
||||
.set(AssociationWarehouse::getUpdateBy, loginUser.getUserid())
|
||||
.set(AssociationWarehouse::getUpdateByName, loginUser.getUsername())
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.eq(AssociationWarehouse::getIsDefault, 2)
|
||||
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||
//设置新的默认仓库
|
||||
associationWarehouseService.update(null, new UpdateWrapper<AssociationWarehouse>().lambda()
|
||||
.set(AssociationWarehouse::getIsDefault, 2)
|
||||
.set(AssociationWarehouse::getUpdateBy, loginUser.getUserid())
|
||||
.set(AssociationWarehouse::getUpdateByName, loginUser.getUsername())
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseDO.getWarehouseId())
|
||||
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||
AssociationWarehouseCacheUtil.setCache(associationWarehouseCacheDO.getCorrelationId(), associationWarehouseCacheDO);
|
||||
return associationWarehouseCacheDO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 查询关联仓库列表根据关联id
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/11 15:34
|
||||
* @param correlationId
|
||||
* @return List<AssociationWarehousePO>
|
||||
*/
|
||||
public AssociationWarehouseCacheDO getWarehouseInfo(Long correlationId) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = AssociationWarehouseCacheUtil.getCache(correlationId);
|
||||
if (ObjectUtil.isNotNull(associationWarehouseCacheDO)){
|
||||
return associationWarehouseCacheDO;
|
||||
}
|
||||
AssociationWarehouse associationWarehouse = associationWarehouseService.getOne(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.eq(AssociationWarehouse::getIsDefault, 2)
|
||||
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||
if (ObjectUtil.isNotNull(associationWarehouse)){
|
||||
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
|
||||
BeanUtils.copyProperties(associationWarehouse, associationWarehouseCacheDO);
|
||||
}else {
|
||||
//首次 没有查到默认取第一条数据
|
||||
List<AssociationWarehouse> associationWarehouseList = associationWarehouseService.list(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.orderByAsc(AssociationWarehouse::getAssociationWarehouseId));
|
||||
if (CollectionUtils.isEmpty(associationWarehouseList)){
|
||||
throw new ServiceException("未查询到登录用户关联仓库信息");
|
||||
}
|
||||
AssociationWarehouse associationWarehouseAsc = associationWarehouseList.get(0);
|
||||
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
|
||||
BeanUtils.copyProperties(associationWarehouseAsc, associationWarehouseCacheDO);
|
||||
}
|
||||
associationWarehouseService.update(null, new UpdateWrapper<AssociationWarehouse>().lambda()
|
||||
.set(AssociationWarehouse::getIsDefault, 2)
|
||||
.set(AssociationWarehouse::getUpdateBy, loginUser.getUserid())
|
||||
.set(AssociationWarehouse::getUpdateByName, loginUser.getUsername())
|
||||
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||
.eq(AssociationWarehouse::getWarehouseId, associationWarehouseCacheDO.getWarehouseId()));
|
||||
AssociationWarehouseCacheUtil.removeDictCache(associationWarehouseCacheDO.getCorrelationId());
|
||||
return associationWarehouseCacheDO;
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 系统协议模版表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/15 15:47
|
||||
*/
|
||||
@Data
|
||||
@TableName("basic_agreement")
|
||||
public class BasicAgreementEntity extends BaseVOEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "系统协议表ID")
|
||||
private Long basicAgreementId;
|
||||
@ApiModelProperty(name = "系统协议内容")
|
||||
private String basicAgreementContent;
|
||||
@ApiModelProperty(name = "系统协议类型数据字典ID")
|
||||
private String basicAgreementTypeId;
|
||||
@ApiModelProperty(name = "系统协议类型名称")
|
||||
private String basicAgreementTypeName;
|
||||
@ApiModelProperty(name = "系统协议类型编码")
|
||||
private String basicAgreementTypeCode;
|
||||
@ApiModelProperty(name = "系统协议状态:0-无状态,1-正常,2-停用")
|
||||
private Integer basicAgreementStatus;
|
||||
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String displayName;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantsId;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.factory;
|
||||
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class BasicAgreementFactory {
|
||||
|
||||
public BasicAgreementEntity getAgreementEntity(BasicAgreementDO basicAgreementDO) {
|
||||
BasicAgreementEntity basicAgreementEntity = new BasicAgreementEntity();
|
||||
BeanUtils.copyProperties(basicAgreementDO, basicAgreementEntity, IgnoreNullUtil.getNullPropertyNames(basicAgreementDO));
|
||||
//获取登录人
|
||||
String userName= SecurityUtils.getLoginUser().getUsername();
|
||||
// 获取登录人id
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
if(basicAgreementEntity.getBasicAgreementId() != null){
|
||||
if(userId != null){
|
||||
basicAgreementEntity.setUpdateBy(userId);
|
||||
}else {
|
||||
basicAgreementEntity.setUpdateBy(new Long("0"));
|
||||
}
|
||||
basicAgreementEntity.setUpdateByName(userName);
|
||||
basicAgreementEntity.setUpdateTime(new Date());
|
||||
}else {
|
||||
if(userId != null){
|
||||
basicAgreementEntity.setCreateBy(userId);
|
||||
basicAgreementEntity.setUpdateBy(userId);
|
||||
}else {
|
||||
basicAgreementEntity.setCreateBy(new Long("0"));
|
||||
basicAgreementEntity.setUpdateBy(new Long("0"));
|
||||
}
|
||||
basicAgreementEntity.setCreateByName(userName);
|
||||
basicAgreementEntity.setUpdateByName(userName);
|
||||
basicAgreementEntity.setCreateTime(new Date());
|
||||
basicAgreementEntity.setUpdateTime(new Date());
|
||||
basicAgreementEntity.setDelFlag(1);
|
||||
}
|
||||
return basicAgreementEntity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.po.BasicAgreementPO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BasicAgreementRepositoryInterface extends IService<BasicAgreementEntity> {
|
||||
List<BasicAgreementEntity> selectList(BasicAgreementDO basicAgreementDO);
|
||||
|
||||
BasicAgreementPO findAgreement(BasicAgreementDO basicAgreementDO);
|
||||
|
||||
int addAgreement(BasicAgreementEntity basicAgreementEntity);
|
||||
|
||||
int updateAgreement(BasicAgreementEntity basicAgreementEntity);
|
||||
|
||||
BasicAgreementEntity selectById(Long basicAgreementId);
|
||||
|
||||
BasicAgreementEntity selectByCode(String basicAgreementTypeCode);
|
||||
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.po.BasicAgreementPO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BasicAgreementMapper extends BaseMapper<BasicAgreementEntity> {
|
||||
|
||||
List<BasicAgreementEntity> selectList(@Param("basicAgreementDO") BasicAgreementDO basicAgreementDO);
|
||||
|
||||
BasicAgreementPO findAgreement(@Param("basicAgreementDO")BasicAgreementDO basicAgreementDO);
|
||||
|
||||
BasicAgreementEntity selectByCode(@Param("basicAgreementTypeCode")String basicAgreementTypeCode);
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.facade.BasicAgreementRepositoryInterface;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.po.BasicAgreementPO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.mapper.BasicAgreementMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BasicAgreementRepositoryImpl extends ServiceImpl<BasicAgreementMapper,BasicAgreementEntity> implements BasicAgreementRepositoryInterface {
|
||||
|
||||
@Resource
|
||||
private BasicAgreementMapper basicAgreementMapper;
|
||||
|
||||
@Override
|
||||
public List<BasicAgreementEntity> selectList(BasicAgreementDO basicAgreementDO) {
|
||||
return basicAgreementMapper.selectList(basicAgreementDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicAgreementPO findAgreement(BasicAgreementDO basicAgreementDO){
|
||||
return basicAgreementMapper.findAgreement(basicAgreementDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addAgreement(BasicAgreementEntity basicAgreementEntity) {
|
||||
return basicAgreementMapper.insert(basicAgreementEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAgreement(BasicAgreementEntity basicAgreementEntity) {
|
||||
return basicAgreementMapper.updateById(basicAgreementEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicAgreementEntity selectById(Long basicAgreementId) {
|
||||
return basicAgreementMapper.selectById(basicAgreementId);
|
||||
}
|
||||
@Override
|
||||
public BasicAgreementEntity selectByCode(String basicAgreementTypeCode) {
|
||||
return basicAgreementMapper.selectByCode(basicAgreementTypeCode);
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.repository.po;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicAgreementPO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "系统协议表ID")
|
||||
private Long basicAgreementId = 0L;
|
||||
@ApiModelProperty(name = "系统协议内容")
|
||||
private String basicAgreementContent = "";
|
||||
@ApiModelProperty(name = "系统协议类型数据字典ID")
|
||||
private Long basicAgreementTypeId = 0L;
|
||||
@ApiModelProperty(name = "系统协议类型名称")
|
||||
private String basicAgreementTypeName = "";
|
||||
@ApiModelProperty(name = "系统协议类型编码")
|
||||
private String basicAgreementTypeCode = "";
|
||||
@ApiModelProperty(name = "系统协议状态:0-无状态,1-正常,2-停用")
|
||||
private Integer basicAgreementStatus = 0;
|
||||
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String displayName;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantsId;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.repository.todo;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicAgreementDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "系统协议表ID")
|
||||
private Long basicAgreementId;
|
||||
@ApiModelProperty(name = "系统协议内容")
|
||||
private String basicAgreementContent;
|
||||
@ApiModelProperty(name = "系统协议类型数据字典ID")
|
||||
private String basicAgreementTypeId;
|
||||
@ApiModelProperty(name = "系统协议类型名称")
|
||||
private String basicAgreementTypeName;
|
||||
@ApiModelProperty(name = "系统协议类型编码")
|
||||
private String basicAgreementTypeCode;
|
||||
@ApiModelProperty(name = "系统协议状态:0-无状态,1-正常,2-停用")
|
||||
private Integer basicAgreementStatus;
|
||||
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String displayName;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantsId;
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.mhd.basic.domain.basicAgreementAggregate.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.entity.BasicAgreementEntity;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.facade.BasicAgreementRepositoryInterface;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.po.BasicAgreementPO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.repository.todo.BasicAgreementDO;
|
||||
import com.mhd.basic.domain.basicAgreementAggregate.factory.BasicAgreementFactory;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BasicAgreementDomainService {
|
||||
|
||||
@Autowired
|
||||
private BasicAgreementFactory basicAgreementFactory;
|
||||
@Resource
|
||||
private BasicAgreementRepositoryInterface basicAgreementRepositoryInterface;
|
||||
|
||||
public List<BasicAgreementEntity> selectList(BasicAgreementDO basicAgreementDO) {
|
||||
return basicAgreementRepositoryInterface.selectList(basicAgreementDO);
|
||||
}
|
||||
|
||||
public BasicAgreementPO findAgreement(BasicAgreementDO basicAgreementDO){
|
||||
return basicAgreementRepositoryInterface.findAgreement(basicAgreementDO);
|
||||
}
|
||||
|
||||
public int addAgreement(BasicAgreementEntity basicAgreementEntity) {
|
||||
return basicAgreementRepositoryInterface.addAgreement(basicAgreementEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增协议
|
||||
* @Author Alex
|
||||
* @Date 2022/11/24 11:05
|
||||
*/
|
||||
public int updateAgreement(BasicAgreementEntity basicAgreementEntity) {
|
||||
return basicAgreementRepositoryInterface.updateAgreement(basicAgreementEntity);
|
||||
}
|
||||
|
||||
public int deleteByIds(List<Long> ids) {
|
||||
for (Long basicAgreementId : ids) {
|
||||
BasicAgreementEntity basicAgreementEntity = basicAgreementRepositoryInterface.selectById(basicAgreementId);
|
||||
if (ObjectUtil.isNotNull(basicAgreementEntity)) {
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
basicAgreementEntity.setDelFlag(2);
|
||||
basicAgreementEntity.setUpdateTime(new Date());
|
||||
basicAgreementRepositoryInterface.updateAgreement(basicAgreementEntity);
|
||||
}
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code和组织获取协议内容
|
||||
* @param basicAgreementDO
|
||||
* @return
|
||||
*/
|
||||
public BasicAgreementEntity getAgreementByCode(BasicAgreementDO basicAgreementDO) {
|
||||
LambdaQueryWrapper<BasicAgreementEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BasicAgreementEntity::getBasicAgreementTypeCode,basicAgreementDO.getBasicAgreementTypeCode());
|
||||
queryWrapper.eq(BasicAgreementEntity::getOrganizationId,basicAgreementDO.getOrganizationId());
|
||||
queryWrapper.eq(BasicAgreementEntity::getBasicAgreementStatus,1);
|
||||
queryWrapper.eq(BasicAgreementEntity::getDelFlag,1);
|
||||
return basicAgreementRepositoryInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据协议id查询协议内容
|
||||
* @param basicAgreementId
|
||||
* @return
|
||||
*/
|
||||
public BasicAgreementEntity selectByAgreementId(Long basicAgreementId) {
|
||||
LambdaQueryWrapper<BasicAgreementEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BasicAgreementEntity::getBasicAgreementId,basicAgreementId);
|
||||
queryWrapper.eq(BasicAgreementEntity::getDelFlag,1);
|
||||
return basicAgreementRepositoryInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public BasicAgreementEntity findAgreementByCodeAndOrg(BasicAgreementDO basicAgreementDO) {
|
||||
if(StringUtils.isEmpty(basicAgreementDO.getBasicAgreementTypeCode())){
|
||||
throw new ServiceException("协议code不能为空");
|
||||
}
|
||||
if(basicAgreementDO.getOrganizationId() == null){
|
||||
throw new ServiceException("组织id不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<BasicAgreementEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BasicAgreementEntity::getBasicAgreementTypeCode,basicAgreementDO.getBasicAgreementTypeCode());
|
||||
queryWrapper.eq(BasicAgreementEntity::getOrganizationId,basicAgreementDO.getOrganizationId());
|
||||
queryWrapper.eq(BasicAgreementEntity::getDelFlag,1);
|
||||
return basicAgreementRepositoryInterface.getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mhd.basic.domain.batch.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理对象 batch
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Batch extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次编码")
|
||||
@Excel(name = "批次编码")
|
||||
private String batchCode;
|
||||
|
||||
@ApiModelProperty("批次名称")
|
||||
@Excel(name = "批次名称")
|
||||
private String batchName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("启用状态: 1-启用 2-停用")
|
||||
@Excel(name = "启用状态: 1-启用 2-停用")
|
||||
private Integer openingUp;
|
||||
|
||||
@ApiModelProperty("是否作废: 1-否 2-是")
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.basic.domain.batch.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.batch.entity.Batch;
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批次管理Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface IBatchService extends IService<Batch>
|
||||
{
|
||||
/**
|
||||
* 分页查询批次管理列表
|
||||
*/
|
||||
public List<BatchPO> queryList(BatchDO batchDO);
|
||||
|
||||
/**
|
||||
* 新增批次管理
|
||||
*/
|
||||
public Long insert(BatchDO batchDO);
|
||||
|
||||
/**
|
||||
* 修改批次管理
|
||||
*/
|
||||
public Boolean update(BatchDO batchDO);
|
||||
|
||||
/**
|
||||
* 批量删除批次管理
|
||||
*/
|
||||
public Boolean delete(Long[] batchIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询批次管理
|
||||
*/
|
||||
public BatchPO getInfo(Long batchId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.basic.domain.batch.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.batch.entity.Batch;
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 批次管理Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface BatchMapper extends BaseMapper<Batch>
|
||||
{
|
||||
/**
|
||||
* 查询批次管理列表
|
||||
*/
|
||||
public List<BatchPO> queryList(BatchDO batchDO);
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.mhd.basic.domain.batch.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.batch.entity.Batch;
|
||||
import com.mhd.basic.domain.batch.repository.facade.IBatchService;
|
||||
import com.mhd.basic.domain.batch.repository.mapper.BatchMapper;
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.brand.entity.Brand;
|
||||
import com.mhd.basic.domain.brand.repository.todo.BrandDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批次管理Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
public class BatchImpl extends ServiceImpl<BatchMapper, Batch> implements IBatchService{
|
||||
@Autowired
|
||||
private BatchMapper batchMapper;
|
||||
|
||||
/**
|
||||
* 查询批次管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<BatchPO> queryList(BatchDO batchDO)
|
||||
{
|
||||
return batchMapper.queryList(batchDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增批次管理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long insert(BatchDO batchDO) {
|
||||
//唯一性校验
|
||||
verifyUniqueness(batchDO);
|
||||
Batch batch = new Batch();
|
||||
BeanUtils.copyProperties(batchDO,batch);
|
||||
this.save(batch);
|
||||
return batch.getBatchId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(BatchDO batchDO) {
|
||||
//唯一性校验
|
||||
verifyUniqueness(batchDO);
|
||||
Batch batch = new Batch();
|
||||
BeanUtils.copyProperties(batchDO,batch);
|
||||
return this.updateById(batch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 校验唯一
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/9 21:10
|
||||
* @param batchDO
|
||||
*/
|
||||
private void verifyUniqueness(BatchDO batchDO){
|
||||
int count = batchMapper.selectCount(new QueryWrapper<Batch>().lambda()
|
||||
.eq(Batch::getBatchCode,batchDO.getBatchCode())
|
||||
.eq(Batch::getOrganizationId, batchDO.getOrganizationId())
|
||||
.ne(batchDO.getBatchId() != null, Batch::getBatchId, batchDO.getBatchId())
|
||||
.eq(Batch::getDelFlag,1));
|
||||
if (count > 0){
|
||||
throw new ServiceException("批次编码【" + batchDO.getBatchCode() + "】已存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] batchIds ) {
|
||||
List<Batch> list = new ArrayList<>();
|
||||
for (Long id : batchIds) {
|
||||
Batch batch = new Batch();
|
||||
batch.setBatchId(id);
|
||||
batch.setDelFlag(2);
|
||||
list.add(batch);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理
|
||||
*/
|
||||
@Override
|
||||
public BatchPO getInfo(Long batchId) {
|
||||
Batch batch = this.getById(batchId);
|
||||
BatchPO batchPO = new BatchPO();
|
||||
BeanUtils.copyProperties(batch,batchPO);
|
||||
return batchPO;
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.basic.domain.batch.repository.po;
|
||||
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理对象 batch
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "批次管理对象", description = "批次管理响应对象")
|
||||
public class BatchPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次编码")
|
||||
@Excel(name = "批次编码")
|
||||
private String batchCode;
|
||||
|
||||
@ApiModelProperty("批次名称")
|
||||
@Excel(name = "批次名称")
|
||||
private String batchName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("启用状态: 1-启用 2-停用")
|
||||
@Excel(name = "启用状态: 1-启用 2-停用")
|
||||
private Integer openingUp;
|
||||
|
||||
@ApiModelProperty("是否作废: 1-否 2-是")
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty("批次明细集合")
|
||||
private List<BatchDetailPO> batchDetailList;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.basic.domain.batch.repository.todo;
|
||||
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理对象 batch
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BatchDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次编码")
|
||||
@Excel(name = "批次编码")
|
||||
private String batchCode;
|
||||
|
||||
@ApiModelProperty("批次名称")
|
||||
@Excel(name = "批次名称")
|
||||
private String batchName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("启用状态: 1-启用 2-停用")
|
||||
@Excel(name = "启用状态: 1-启用 2-停用")
|
||||
private Integer openingUp;
|
||||
|
||||
@ApiModelProperty("是否作废: 1-否 2-是")
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("批次明细集合")
|
||||
private List<BatchDetailDO> batchDetailList;
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.mhd.basic.domain.batch.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.mhd.basic.domain.batch.entity.Batch;
|
||||
import com.mhd.basic.domain.batch.repository.facade.IBatchService;
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.facade.IBatchDetailService;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import com.mhd.basic.domain.brand.entity.Brand;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 批次管理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BatchDomainService {
|
||||
|
||||
@Autowired
|
||||
private IBatchService batchService;
|
||||
@Autowired
|
||||
private IBatchDetailService batchDetailService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询批次管理列表
|
||||
*/
|
||||
public List<BatchPO> queryList(BatchDO batchDO) {
|
||||
return batchService.queryList(batchDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增批次管理
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(BatchDO batchDO) {
|
||||
Long batchId = batchService.insert(batchDO);
|
||||
batchDO.setBatchId(batchId);
|
||||
return batchDetailService.batchInsertOrUpdate(batchDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(BatchDO batchDO) {
|
||||
batchService.update(batchDO);
|
||||
return batchDetailService.batchInsertOrUpdate(batchDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理
|
||||
*/
|
||||
public Boolean delete(Long[] batchIds) {
|
||||
return batchService.delete(batchIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次管理详细信息
|
||||
*/
|
||||
public BatchPO getInfo(Long batchId)
|
||||
{
|
||||
BatchPO batchPO = batchService.getInfo(batchId);
|
||||
BatchDetailDO batchDetailDO = new BatchDetailDO();
|
||||
batchDetailDO.setBatchId(batchId);
|
||||
List<BatchDetailPO> batchDetailPOList = batchDetailService.queryList(batchDetailDO);
|
||||
batchPO.setBatchDetailList(batchDetailPOList);
|
||||
return batchPO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 根据id作废批次
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/10 15:28
|
||||
* @param batchId
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(Long[] batchId) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return batchService.update(null, new UpdateWrapper<Batch>().lambda()
|
||||
.set(Batch::getNullify, 1)
|
||||
.set(Batch::getUpdateTime, new Date())
|
||||
.set(Batch::getUpdateBy, loginUser.getUserid())
|
||||
.set(Batch::getUpdateByName, loginUser.getUsername())
|
||||
.in(Batch::getBatchId, Arrays.asList(batchId)));
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.mhd.basic.domain.batchDetail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理详情对象 batch_detail
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BatchDetail extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次管理详情id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long batchDetailId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
@Excel(name = "批次id")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("批次标签")
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
|
||||
@ApiModelProperty("属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
@Excel(name = "属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
private String attributeFormat;
|
||||
|
||||
@ApiModelProperty("属性选项")
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.batchDetail.entity.BatchDetail;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批次管理详情Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface IBatchDetailService extends IService<BatchDetail>
|
||||
{
|
||||
/**
|
||||
* 分页查询批次管理详情列表
|
||||
*/
|
||||
public List<BatchDetailPO> queryList(BatchDetailDO batchDetailDO);
|
||||
|
||||
/**
|
||||
* 新增批次管理详情
|
||||
*/
|
||||
public Boolean insert(BatchDetailDO batchDetailDO);
|
||||
|
||||
/**
|
||||
* 批量新增批次管理详情
|
||||
*/
|
||||
public Boolean batchInsertOrUpdate(BatchDO batchDO);
|
||||
|
||||
/**
|
||||
* 修改批次管理详情
|
||||
*/
|
||||
public Boolean update(BatchDetailDO batchDetailDO);
|
||||
|
||||
/**
|
||||
* 批量删除批次管理详情
|
||||
*/
|
||||
public Boolean delete(Long[] batchDetailIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询批次管理详情
|
||||
*/
|
||||
public BatchDetailPO getInfo(Long batchDetailId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.batchDetail.entity.BatchDetail;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 批次管理详情Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface BatchDetailMapper extends BaseMapper<BatchDetail>
|
||||
{
|
||||
/**
|
||||
* 查询批次管理详情列表
|
||||
*/
|
||||
public List<BatchDetailPO> queryList(BatchDetailDO batchDetailDO);
|
||||
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.persistence;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.batchDetail.entity.BatchDetail;
|
||||
import com.mhd.basic.domain.batchDetail.repository.facade.IBatchDetailService;
|
||||
import com.mhd.basic.domain.batchDetail.repository.mapper.BatchDetailMapper;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 批次管理详情Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail> implements IBatchDetailService{
|
||||
@Autowired
|
||||
private BatchDetailMapper batchDetailMapper;
|
||||
|
||||
/**
|
||||
* 查询批次管理详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<BatchDetailPO> queryList(BatchDetailDO batchDetailDO)
|
||||
{
|
||||
return batchDetailMapper.queryList(batchDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增批次管理详情
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(BatchDetailDO batchDetailDO) {
|
||||
BatchDetail batchDetail = new BatchDetail();
|
||||
BeanUtils.copyProperties(batchDetailDO,batchDetail);
|
||||
return this.save(batchDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增批次管理详情
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsertOrUpdate(BatchDO batchDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
List<BatchDetailDO> batchDetailDOList = batchDO.getBatchDetailList();
|
||||
//验证提交的数据是否存在重复
|
||||
long count = batchDetailDOList.stream().map(BatchDetailDO::getBatchLabels).distinct().count();
|
||||
if (batchDetailDOList.size() != count){
|
||||
throw new ServiceException("批次标签不允许重复,请检查提交的数据");
|
||||
}
|
||||
List<BatchDetail> batchDetailDbList = batchDetailMapper.selectList(new QueryWrapper<BatchDetail>().lambda()
|
||||
.eq(BatchDetail::getBatchId, batchDO.getBatchId()));
|
||||
List<BatchDetail> batchDetailListSave = new ArrayList<>();
|
||||
List<BatchDetail> batchDetailListUpdates = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(batchDetailDbList)){
|
||||
Map<String, BatchDetail> batchDetailMap = batchDetailDbList.stream().collect(Collectors.toMap(BatchDetail::getBatchLabels, Function.identity()));
|
||||
for (BatchDetailDO batchDetailDO : batchDetailDOList){
|
||||
BatchDetail batchDetailDb = batchDetailMap.get(batchDetailDO.getBatchLabels());
|
||||
if (batchDetailDb != null){
|
||||
batchDetailDb.setBatchLabels(batchDetailDO.getBatchLabels());
|
||||
batchDetailDb.setInputControl(batchDetailDO.getInputControl());
|
||||
batchDetailDb.setAttributeFormat(batchDetailDO.getAttributeFormat());
|
||||
batchDetailDb.setAttributeOption(batchDetailDO.getAttributeOption());
|
||||
batchDetailDb.setRemark(batchDetailDO.getRemark());
|
||||
batchDetailDb.setDelFlag(1);
|
||||
batchDetailListUpdates.add(batchDetailDb);
|
||||
} else {
|
||||
BatchDetail batchDetail = new BatchDetail();
|
||||
BeanUtils.copyProperties(batchDetailDO, batchDetail);
|
||||
batchDetail.setBatchId(batchDO.getBatchId());
|
||||
batchDetail.setOrganizationId(batchDO.getOrganizationId());
|
||||
batchDetail.setOrganizationName(batchDO.getOrganizationName());
|
||||
batchDetail.setTopOrganizationId(batchDO.getTopOrganizationId());
|
||||
batchDetail.setCreateBy(userPo.getUserId());
|
||||
batchDetail.setCreateByName(userPo.getUserName());
|
||||
batchDetail.setCreateTime(new Date());
|
||||
batchDetailListSave.add(batchDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除 之前存在 现在没有的
|
||||
List<Long> batchDetailIds = batchDetailDbList.stream().map(BatchDetail::getBatchDetailId).collect(Collectors.toList());
|
||||
List<Long> batchDetailIdsExist = batchDetailDOList.stream().map(BatchDetailDO::getBatchDetailId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
batchDetailIds.removeAll(batchDetailIdsExist);
|
||||
if (CollectionUtil.isNotEmpty(batchDetailIds)){
|
||||
//标记之前的标签信息删除
|
||||
batchDetailMapper.update(null, new UpdateWrapper<BatchDetail>().lambda()
|
||||
.set(BatchDetail::getDelFlag, 2)
|
||||
.set(BatchDetail::getUpdateBy, loginUser.getUserid())
|
||||
.set(BatchDetail::getUpdateByName, loginUser.getUsername())
|
||||
.set(BatchDetail::getUpdateTime, new Date())
|
||||
.in(BatchDetail::getBatchDetailId, batchDetailIds));
|
||||
}
|
||||
//新增
|
||||
if (CollectionUtil.isNotEmpty(batchDetailListSave)){
|
||||
saveBatch(batchDetailListSave);
|
||||
}
|
||||
//修改
|
||||
if (CollectionUtil.isNotEmpty(batchDetailListUpdates)){
|
||||
updateBatchById(batchDetailListUpdates);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理详情
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(BatchDetailDO batchDetailDO) {
|
||||
BatchDetail batchDetail = new BatchDetail();
|
||||
BeanUtils.copyProperties(batchDetailDO,batchDetail);
|
||||
return this.updateById(batchDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理详情
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] batchDetailIds ) {
|
||||
List<BatchDetail> list = new ArrayList<>();
|
||||
for (Long id : batchDetailIds) {
|
||||
BatchDetail batchDetail = new BatchDetail();
|
||||
batchDetail.setBatchDetailId(id);
|
||||
batchDetail.setDelFlag(2);
|
||||
list.add(batchDetail);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理详情
|
||||
*/
|
||||
@Override
|
||||
public BatchDetailPO getInfo(Long batchDetailId) {
|
||||
BatchDetail batchDetail = this.getById(batchDetailId);
|
||||
BatchDetailPO batchDetailPO = new BatchDetailPO();
|
||||
BeanUtils.copyProperties(batchDetail,batchDetailPO);
|
||||
return batchDetailPO;
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.po;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理详情对象 batch_detail
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "批次管理详情对象", description = "批次管理详情响应对象")
|
||||
public class BatchDetailPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次管理详情id")
|
||||
private Long batchDetailId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
@Excel(name = "批次id")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("批次标签")
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
|
||||
@ApiModelProperty("属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
@Excel(name = "属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
private String attributeFormat;
|
||||
|
||||
@ApiModelProperty("属性选项")
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 批次管理详情对象 batch_detail
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BatchDetailDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次管理详情id")
|
||||
private Long batchDetailId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("批次id")
|
||||
@Excel(name = "批次id")
|
||||
private Long batchId;
|
||||
|
||||
@ApiModelProperty("批次标签")
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
|
||||
@ApiModelProperty("属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
@Excel(name = "属性格式:1-下拉框 2-日期 3-日期时间 4-数字 5-文本")
|
||||
private String attributeFormat;
|
||||
|
||||
@ApiModelProperty("属性选项")
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
private Long materialBaseInfoId;
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.mhd.basic.domain.batchDetail.service;
|
||||
|
||||
import com.mhd.basic.domain.batchDetail.repository.facade.IBatchDetailService;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.batchDetail.repository.todo.BatchDetailDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 批次管理详情
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BatchDetailDomainService {
|
||||
|
||||
@Autowired
|
||||
private IBatchDetailService batchDetailService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询批次管理详情列表
|
||||
*/
|
||||
public List<BatchDetailPO> queryList(BatchDetailDO batchDetailDO) {
|
||||
return batchDetailService.queryList(batchDetailDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增批次管理详情
|
||||
*/
|
||||
public Boolean insert(BatchDetailDO batchDetailDO) {
|
||||
|
||||
return batchDetailService.insert(batchDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改批次管理详情
|
||||
*/
|
||||
public Boolean update(BatchDetailDO batchDetailDO) {
|
||||
return batchDetailService.update(batchDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除批次管理详情
|
||||
*/
|
||||
public Boolean delete(Long[] batchDetailIds) {
|
||||
return batchDetailService.delete(batchDetailIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次管理详情详细信息
|
||||
*/
|
||||
public BatchDetailPO getInfo(Long batchDetailId)
|
||||
{
|
||||
return batchDetailService.getInfo(batchDetailId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取批次管理详情详细信息
|
||||
*/
|
||||
public List<BatchDetailPO> getBatchDetailListByBatchId(Long batchId) {
|
||||
BatchDetailDO batchDetailDO = new BatchDetailDO();
|
||||
batchDetailDO.setBatchId(batchId);
|
||||
return batchDetailService.queryList(batchDetailDO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mhd.basic.domain.brand.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
/**
|
||||
* 品牌管理对象 brand
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Brand extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("物料分类id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long brandId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
@Excel(name = "货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
@Excel(name = "货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("品牌编码")
|
||||
@Excel(name = "品牌编码")
|
||||
private String brandCode;
|
||||
|
||||
@ApiModelProperty("品牌名称")
|
||||
@Excel(name = "品牌名称")
|
||||
private String brandName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("是否作废: 1-否 2-是")
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.basic.domain.brand.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.brand.entity.Brand;
|
||||
import com.mhd.basic.domain.brand.repository.po.BrandPO;
|
||||
import com.mhd.basic.domain.brand.repository.todo.BrandDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 品牌管理Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface IBrandService extends IService<Brand>
|
||||
{
|
||||
/**
|
||||
* 分页查询品牌管理列表
|
||||
*/
|
||||
public List<BrandPO> queryList(BrandDO brandDO);
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*/
|
||||
public Boolean insert(BrandDO brandDO);
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*/
|
||||
public Boolean update(BrandDO brandDO);
|
||||
|
||||
/**
|
||||
* 批量删除品牌管理
|
||||
*/
|
||||
public Boolean delete(Long[] brandIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询品牌管理
|
||||
*/
|
||||
public BrandPO getInfo(Long brandId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user