first commit
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
package com.mhd.user;
|
||||
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.CommonService;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.SetFeildValueAspect;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"com.mhd", "com.mhd.user"})
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"com.mhd","com.mhd.user.infrastructure.feign"})
|
||||
@MapperScan("com.mhd.user.domain.**.mapper")
|
||||
@Import({SetFeildValueAspect.class, CommonService.class})
|
||||
@EnableAsync
|
||||
public class UserCenterApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(UserCenterApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 用户中台模块启动成功 ლ(´ڡ`ლ)゙ " +
|
||||
"# _oo0oo_\n" +
|
||||
"# o8888888o\n" +
|
||||
"# 88\" . \"88\n" +
|
||||
"# (| -_- |)\n" +
|
||||
"# 0\\ = /0\n" +
|
||||
"# ___/`---'\\___\n" +
|
||||
"# .' \\\\| |// '.\n" +
|
||||
"# / \\\\||| : |||// \\\n" +
|
||||
"# / _||||| -:- |||||- \\\n" +
|
||||
"# | | \\\\\\ - /// | |\n" +
|
||||
"# | \\_| ''\\---/'' |_/ |\n" +
|
||||
"# \\ .-\\__ '-' ___/-. /\n" +
|
||||
"# ___'. .' /--.--\\ `. .'___\n" +
|
||||
"# .\"\" '< `.___\\_<|>_/___.' >' \"\".\n" +
|
||||
"# | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
||||
"# \\ \\ `_. \\_ __\\ /__ _/ .-` / /\n" +
|
||||
"# =====`-.____`.___ \\_____/___.-`___.-'=====\n" +
|
||||
"# `=---='\n" +
|
||||
"#\n" +
|
||||
"#\n" +
|
||||
"# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
|
||||
"#\n" +
|
||||
"# 佛祖保佑 永无BUG\n" +
|
||||
"#\n" +
|
||||
"# ┏┓ ┏┓\n" +
|
||||
"# ┏┛┻━━━┛┻┓\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ ━ ┃\n" +
|
||||
"# ┃ ┳┛ ┗┳ ┃\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ ┻ ┃\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┗━┓ ┏━┛Codes are far away from bugs with the animal protecting\n" +
|
||||
"# ┃ ┃ 神兽保佑,代码无bug\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ ┗━━━┓\n" +
|
||||
"# ┃ ┣┓\n" +
|
||||
"# ┃ ┏┛\n" +
|
||||
"# ┗┓┓┏━┳┓┏┛\n" +
|
||||
"# ┃┫┫ ┃┫┫\n" +
|
||||
"# ┗┻┛ ┗┻┛\n" +
|
||||
"#\n" +
|
||||
"# ┏┓ ┏┓\n" +
|
||||
"# ┏┛┻━━━┛┻┓\n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ━ ┃\n" +
|
||||
"# ┃ > <┃\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ . ⌒ ..┃\n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┗━┓ ┏━┛\n" +
|
||||
"# ┃ ┃ Codes are far away from bugs with the animal protecting \n" +
|
||||
"# ┃ ┃ 神兽保佑,代码无bug\n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ┗━━━┓\n" +
|
||||
"# ┃ ┣┓\n" +
|
||||
"# ┃ ┏┛\n" +
|
||||
"# ┗┓┓┏━┳┓┏┛\n" +
|
||||
"# ┃┫┫ ┃┫┫\n" +
|
||||
"# ┗┻┛ ┗┻┛\n" +
|
||||
"# ┏┓ ┏┓+ +\n" +
|
||||
"# ┏┛┻━━━┛┻┓ + +\n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ━ ┃ ++ + + +\n" +
|
||||
"# ████━████ ┃+\n" +
|
||||
"# ┃ ┃ +\n" +
|
||||
"# ┃ ┻ ┃\n" +
|
||||
"# ┃ ┃ + +\n" +
|
||||
"# ┗━┓ ┏━┛\n" +
|
||||
"# ┃ ┃ \n" +
|
||||
"# ┃ ┃ + + + +\n" +
|
||||
"# ┃ ┃ Codes are far away from bugs with the animal protecting \n" +
|
||||
"# ┃ ┃ + 神兽保佑,代码无bug \n" +
|
||||
"# ┃ ┃\n" +
|
||||
"# ┃ ┃ + \n" +
|
||||
"# ┃ ┗━━━┓ + +\n" +
|
||||
"# ┃ ┣┓\n" +
|
||||
"# ┃ ┏┛\n" +
|
||||
"# ┗┓┓┏━┳┓┏┛ + + + +\n" +
|
||||
"# ┃┫┫ ┃┫┫\n" +
|
||||
"# ┗┻┛ ┗┻┛+ + + +\n" +
|
||||
"# d*##$.\n" +
|
||||
"# zP\"\"\"\"\"$e. $\" $o\n" +
|
||||
"#4$ '$ $\" $\n" +
|
||||
"#'$ '$ J$ $F\n" +
|
||||
"# 'b $k $> $\n" +
|
||||
"# $k $r J$ d$\n" +
|
||||
"# '$ $ $\" $~\n" +
|
||||
"# '$ \"$ '$E $\n" +
|
||||
"# $ $L $\" $F ...\n" +
|
||||
"# $. 4B $ $$$*\"\"\"*b\n" +
|
||||
"# '$ $. $$ $$ $F\n" +
|
||||
"# \"$ R$ $F $\" $\n" +
|
||||
"# $k ?$ u* dF .$\n" +
|
||||
"# ^$. $$\" z$ u$$$$e\n" +
|
||||
"# #$b $E.dW@e$\" ?$\n" +
|
||||
"# #$ .o$$# d$$$$c ?F\n" +
|
||||
"# $ .d$$#\" . zo$> #$r .uF\n" +
|
||||
"# $L .u$*\" $&$$$k .$$d$$F\n" +
|
||||
"# $$\" \"\"^\"$$$P\"$P9$\n" +
|
||||
"# JP .o$$$$u:$P $$\n" +
|
||||
"# $ ..ue$\" \"\" $\"\n" +
|
||||
"# d$ $F $\n" +
|
||||
"# $$ ....udE 4B\n" +
|
||||
"# #$ \"\"\"\"` $r @$\n" +
|
||||
"# ^$L '$ $F\n" +
|
||||
"# RN 4N $\n" +
|
||||
"# *$b d$\n" +
|
||||
"# $$k $F\n" +
|
||||
"# $$b $F\n" +
|
||||
"# $\"\" $F\n" +
|
||||
"# '$ $\n" +
|
||||
"# $L $\n" +
|
||||
"# '$ $\n" +
|
||||
"# $ $\n" +
|
||||
"#\n" +
|
||||
"#\n" +
|
||||
"# ┌─┐ ┌─┐\n" +
|
||||
"# ┌──┘ ┴───────┘ ┴──┐\n" +
|
||||
"# │ │\n" +
|
||||
"# │ ─── │\n" +
|
||||
"# │ ─┬┘ └┬─ │\n" +
|
||||
"# │ │\n" +
|
||||
"# │ ─┴─ │\n" +
|
||||
"# │ │\n" +
|
||||
"# └───┐ ┌───┘\n" +
|
||||
"# │ │\n" +
|
||||
"# │ │\n" +
|
||||
"# │ │\n" +
|
||||
"# │ └──────────────┐\n" +
|
||||
"# │ │\n" +
|
||||
"# │ ├─┐\n" +
|
||||
"# │ ┌─┘\n" +
|
||||
"# │ │\n" +
|
||||
"# └─┐ ┐ ┌───────┬──┐ ┌──┘\n" +
|
||||
"# │ ─┤ ─┤ │ ─┤ ─┤\n" +
|
||||
"# └──┴──┘ └──┴──┘\n" +
|
||||
"# 神兽保佑\n" +
|
||||
"# 代码无BUG!\n" +
|
||||
"#\n" +
|
||||
"# ___====-_ _-====___\n" +
|
||||
"# _--^^^#####// \\\\#####^^^--_\n" +
|
||||
"# _-^##########// ( ) \\\\##########^-_\n" +
|
||||
"# -############// |\\^^/| \\\\############-\n" +
|
||||
"# _/############// (@::@) \\\\############\\_\n" +
|
||||
"# /#############(( \\\\// ))#############\\\n" +
|
||||
"# -###############\\\\ (oo) //###############-\n" +
|
||||
"# -#################\\\\ / VV \\ //#################-\n" +
|
||||
"# -###################\\\\/ \\//###################-\n" +
|
||||
"# _#/|##########/\\######( /\\ )######/\\##########|\\#_\n" +
|
||||
"# |/ |#/\\#/\\#/\\/ \\#/\\##\\ | | /##/\\#/ \\/\\#/\\#/\\#| \\|\n" +
|
||||
"# ` |/ V V ` V \\#\\| | | |/#/ V ' V V \\| '\n" +
|
||||
"# ` ` ` ` / | | | | \\ ' ' ' '\n" +
|
||||
"# ( | | | | )\n" +
|
||||
"# __\\ | | | | /__\n" +
|
||||
"# (vvv(VVV)(VVV)vvv)\n" +
|
||||
"# 神兽保佑\n" +
|
||||
"# 代码无BUG!\n" +
|
||||
"# __----~~~~~~~~~~~------___\n" +
|
||||
"# . . ~~//====...... __--~ ~~\n" +
|
||||
"# -. \\_|// |||\\\\ ~~~~~~::::... /~\n" +
|
||||
"# ___-==_ _-~o~ \\/ ||| \\\\ _/~~-\n" +
|
||||
"# __---~~~.==~||\\=_ -_--~/_-~|- |\\\\ \\\\ _/~\n" +
|
||||
"# _-~~ .=~ | \\\\-_ '-~7 /- / || \\ /\n" +
|
||||
"# .~ .~ | \\\\ -_ / /- / || \\ /\n" +
|
||||
"# / ____ / | \\\\ ~-_/ /|- _/ .|| \\ /\n" +
|
||||
"# |~~ ~~|--~~~~--_ \\ ~==-/ | \\~--===~~ .\\\n" +
|
||||
"# ' ~-| /| |-~\\~~ __--~~\n" +
|
||||
"# |-~~-_/ | | ~\\_ _-~ /\\\n" +
|
||||
"# / \\ \\__ \\/~ \\__\n" +
|
||||
"# _--~ _/ | .-~~____--~-/ ~~==.\n" +
|
||||
"# ((->/~ '.|||' -_| ~~-/ , . _||\n" +
|
||||
"# -_ ~\\ ~~---l__i__i__i--~~_/\n" +
|
||||
"# _-~-__ ~) \\--______________--~~\n" +
|
||||
"# //.-~~~-~_--~- |-------~~~~~~~~\n" +
|
||||
"# //.-~~~--\\\n" +
|
||||
"# 神兽保佑\n" +
|
||||
"# 代码无BUG!\n" +
|
||||
"# ,----------------, ,---------,\n" +
|
||||
"# ,-----------------------, ,\" ,\"|\n" +
|
||||
"# ,\" ,\"| ,\" ,\" |\n" +
|
||||
"# +-----------------------+ | ,\" ,\" |\n" +
|
||||
"# | .-----------------. | | +---------+ |\n" +
|
||||
"# | | | | | | -==----'| |\n" +
|
||||
"# | | I LOVE DOS! | | | | | |\n" +
|
||||
"# | | Bad command or | | |/----|`---= | |\n" +
|
||||
"# | | C:\\>_ | | | ,/|==== ooo | ;\n" +
|
||||
"# | | | | | // |(((( [33]| ,\"\n" +
|
||||
"# | `-----------------' |,\" .;'| |(((( | ,\"\n" +
|
||||
"# +-----------------------+ ;; | | |,\"\n" +
|
||||
"# /_)______________(_/ //' | +---------+\n" +
|
||||
"# ___________________________/___ `,\n" +
|
||||
"# / oooooooooooooooo .o. oooo /, \\,\"-----------\n" +
|
||||
"# / ==ooooooooooooooo==.o. ooo= // ,`\\--{)B ,\"\n" +
|
||||
"# /_==__==========__==_ooo__ooo=_/' /___________,\"\n" +
|
||||
"#\n" +
|
||||
"# .-~~~~~~~~~-._ _.-~~~~~~~~~-.\n" +
|
||||
"# __.' ~. .~ `.__\n" +
|
||||
"# .'// \\./ \\\\`.\n" +
|
||||
"# .'// | \\\\`.\n" +
|
||||
"# .'// .-~\"\"\"\"\"\"\"~~~~-._ | _,-~~~~\"\"\"\"\"\"\"~-. \\\\`.\n" +
|
||||
"# .'//.-\" `-. | .-' \"-.\\\\`.\n" +
|
||||
"# .'//______.============-.. \\ | / ..-============.______\\\\`.\n" +
|
||||
"# .'______________________________\\|/______________________________`.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
## 应用层
|
||||
|
||||
主要负责获取输入,组装上下文,做输入校验,调用领域层做业务处理,
|
||||
如果需要的话,发送消息通知
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 地址格式化服务
|
||||
*/
|
||||
@Service
|
||||
public class AddressFormattingService {
|
||||
/**
|
||||
* 预编译得正则表达式,用于匹配中国行政区划单位。
|
||||
* 匹配单位: 省, 自治区, 直辖市, 特别行政区, 市, 自治州, 地区, 盟, 县, 自治县, 区, 旗, 自治旗。
|
||||
* (?!/|$) 是一个负向先行断言,确保匹配的位置后面不是'/'或字符串的结尾,
|
||||
* 这样可以避免在末尾添加多余的'/'或在已有'/'的地方重复添加。
|
||||
*/
|
||||
private static final Pattern ADDRESS_UNIT_PATTERN = Pattern.compile(
|
||||
"(省|自治区|市|特别行政区|自治州|地区|盟|县|自治县|区|旗|自治旗)(?!/|$)"
|
||||
);
|
||||
|
||||
private static final String REPLACEMENT = "$1/";
|
||||
|
||||
/**
|
||||
* 将中国行政区划地址字符串格式化为以'/'分隔的形式。
|
||||
* <p>
|
||||
* 例如: "山东省临沂市罗庄区" -> "山东省/临沂市/罗庄区"
|
||||
*
|
||||
* @param rawAddress 原始的、连续的地址字符串。如果为 null 或空白,将原样返回。
|
||||
* @return 格式化后的地址字符串。
|
||||
*/
|
||||
public String formatChineseAddress(String rawAddress) {
|
||||
// 对 null 或空白字符串进行防御性编程
|
||||
if (!StringUtils.hasText(rawAddress)) {
|
||||
return rawAddress;
|
||||
}
|
||||
|
||||
// 使用正则表达式将 "山东省临沂市罗庄区" 替换为 "山东省/临沂市/罗庄区"
|
||||
return ADDRESS_UNIT_PATTERN.matcher(rawAddress).replaceAll(REPLACEMENT);
|
||||
}
|
||||
}
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.thirdparty.SysDepartInterfaceInfoPo;
|
||||
import com.mhd.common.core.domain.thirdparty.SysDepartInterfaceInfoDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.esignsaas.EsignSaasFillTemplateDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.esignsaas.EsignSaasGetSignByFlowIdDTO;
|
||||
import com.mhd.common.core.domain.thirdparty.esignsaas.EsignSaasSignContractV3DTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.system.api.domain.TmsCollectionAgentWlhyDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.function.StreamBridge;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 车队邀请记录ApplicationService
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AgentSignApplicationService {
|
||||
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Autowired
|
||||
private MotorcadeCollectionApplicationService motorcadeCollectionApplicationService;
|
||||
// @Autowired
|
||||
// private StreamBridge streamBridge;
|
||||
|
||||
//签订代收款协议
|
||||
public String signAgreement(LoginUser loginUser, TmsCollectionAgentWlhyDTO tmsCollectionAgentWlhyDTO, MotorcadeCollection motorcadeCollection) {
|
||||
Map<String, String> thirdInfo = getThirdInfo(loginUser.getUserPo().getTopOrganizationId(), "esign_saas");
|
||||
|
||||
//填充模板
|
||||
String fillFlowId = fillTemplate(thirdInfo, tmsCollectionAgentWlhyDTO);
|
||||
motorcadeCollection.setFileId(fillFlowId);
|
||||
motorcadeCollection.setContractStatus(2);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(motorcadeCollection);
|
||||
|
||||
//发起签署
|
||||
String signFlowId = signContract(fillFlowId, thirdInfo, tmsCollectionAgentWlhyDTO);
|
||||
motorcadeCollection.setFlowId(signFlowId);
|
||||
motorcadeCollection.setContractStatus(3);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(motorcadeCollection);
|
||||
//获取签署链接
|
||||
String signUrl = getSignContractUrl(signFlowId, tmsCollectionAgentWlhyDTO.getPhoneC());
|
||||
motorcadeCollection.setAgreementUrl(signUrl);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(motorcadeCollection);
|
||||
return signUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充模板
|
||||
* @return
|
||||
*/
|
||||
public String fillTemplate(Map<String, String> thirdInfo, TmsCollectionAgentWlhyDTO tmsCollectionAgentWlhyDTO){
|
||||
//填充模板
|
||||
EsignSaasFillTemplateDTO esignSaasFillTemplateDTO = new EsignSaasFillTemplateDTO();
|
||||
//填充字段
|
||||
Map<String, String> txtFields = new HashMap<>();
|
||||
txtFields.put("partyA.1", tmsCollectionAgentWlhyDTO.getPartyA());
|
||||
txtFields.put("partyA.2", tmsCollectionAgentWlhyDTO.getPartyA());
|
||||
txtFields.put("partyB.1", tmsCollectionAgentWlhyDTO.getPartyB());
|
||||
txtFields.put("partyB.2", tmsCollectionAgentWlhyDTO.getPartyB());
|
||||
txtFields.put("partyC.1", tmsCollectionAgentWlhyDTO.getPartyC());
|
||||
txtFields.put("partyC.2", tmsCollectionAgentWlhyDTO.getPartyC());
|
||||
txtFields.put("account", tmsCollectionAgentWlhyDTO.getAccountNo());
|
||||
txtFields.put("cardNum", tmsCollectionAgentWlhyDTO.getBankCard());
|
||||
txtFields.put("bankName", tmsCollectionAgentWlhyDTO.getBankName());
|
||||
txtFields.put("contactsA", tmsCollectionAgentWlhyDTO.getContactsA());
|
||||
txtFields.put("contactsB", tmsCollectionAgentWlhyDTO.getContactsB());
|
||||
txtFields.put("contactsC", tmsCollectionAgentWlhyDTO.getContactsC());
|
||||
txtFields.put("phoneA", tmsCollectionAgentWlhyDTO.getPhoneA());
|
||||
txtFields.put("phoneB", tmsCollectionAgentWlhyDTO.getPhoneB());
|
||||
txtFields.put("phoneC", tmsCollectionAgentWlhyDTO.getPhoneC());
|
||||
txtFields.put("idNumA", tmsCollectionAgentWlhyDTO.getIdNumA());
|
||||
txtFields.put("idNumB", tmsCollectionAgentWlhyDTO.getIdNumB());
|
||||
txtFields.put("idNumC", tmsCollectionAgentWlhyDTO.getIdNumC());
|
||||
Date date = org.springframework.util.StringUtils.isEmpty(tmsCollectionAgentWlhyDTO.getSigningDate()) ? new Date() : tmsCollectionAgentWlhyDTO.getSigningDate();
|
||||
txtFields.put("date", DateUtil.format(date, "yyyy年MM月dd日"));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String createTime = sdf.format(date);
|
||||
LocalDate localDate = LocalDate.parse(createTime);
|
||||
stringBuilder.append(localDate).append("至").append(localDate.plusYears(1));
|
||||
txtFields.put("dateSeg", stringBuilder.toString());
|
||||
|
||||
esignSaasFillTemplateDTO.setDocTemplateId(thirdInfo.get("esign_agent_template_id"));
|
||||
esignSaasFillTemplateDTO.setFileName(thirdInfo.get("esign_agent_file_name"));
|
||||
|
||||
|
||||
//这里需要处理掉map中value为null的数据
|
||||
Map<String, String> filteredMap = txtFields.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() != null)
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
Map.Entry::getValue
|
||||
));
|
||||
List<EsignSaasFillTemplateDTO.Component> componentList = new ArrayList<>();
|
||||
for (String s : filteredMap.keySet()) {
|
||||
EsignSaasFillTemplateDTO.Component component = new EsignSaasFillTemplateDTO.Component();
|
||||
component.setComponentKey(s);
|
||||
component.setComponentValue(filteredMap.get(s));
|
||||
componentList.add(component);
|
||||
}
|
||||
esignSaasFillTemplateDTO.setComponents(componentList);
|
||||
log.info("填充模板请求参数:"+ JSON.toJSONString(esignSaasFillTemplateDTO));
|
||||
//开始填充
|
||||
R<String> stringR = thirdPartyServiceFeign.filltemplate(esignSaasFillTemplateDTO);
|
||||
if (R.FAIL == stringR.getCode()) {
|
||||
throw new ServiceException(stringR.getMsg());
|
||||
}
|
||||
String flowId = stringR.getData();
|
||||
return flowId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起签署
|
||||
* @return
|
||||
*/
|
||||
public String signContract(String flowId, Map<String, String> thirdInfo, TmsCollectionAgentWlhyDTO tmsCollectionAgentWlhyDTO){
|
||||
EsignSaasSignContractV3DTO esignSaasSignContractV3DTO = new EsignSaasSignContractV3DTO();
|
||||
//待签署文件信息
|
||||
EsignSaasSignContractV3DTO.Doc doc = new EsignSaasSignContractV3DTO.Doc();
|
||||
doc.setFileId(flowId);
|
||||
doc.setFileName(thirdInfo.get("esign_agent_file_name"));
|
||||
esignSaasSignContractV3DTO.setDocs(CollectionUtil.toList(doc));
|
||||
//流程基本信息
|
||||
EsignSaasSignContractV3DTO.SignFlowConfig signFlowConfig = new EsignSaasSignContractV3DTO.SignFlowConfig();
|
||||
signFlowConfig.setAutoFinish(true);
|
||||
signFlowConfig.setNotifyUrl(thirdInfo.get("esign_agent_call_url"));
|
||||
signFlowConfig.setSignFlowTitle(thirdInfo.get("esign_agent_signFlowTitle"));
|
||||
esignSaasSignContractV3DTO.setSignFlowConfig(signFlowConfig);
|
||||
List<EsignSaasSignContractV3DTO.Signer> signers = new ArrayList<>();
|
||||
//签署方信息
|
||||
//平台签署方
|
||||
EsignSaasSignContractV3DTO.Signer signer = new EsignSaasSignContractV3DTO.Signer();
|
||||
//平台公司签署
|
||||
signer.setSignerType(1);
|
||||
//签署方信息
|
||||
EsignSaasSignContractV3DTO.SignConfig signConfig = new EsignSaasSignContractV3DTO.SignConfig();
|
||||
signConfig.setSignOrder(1);
|
||||
signer.setSignConfig(signConfig);
|
||||
//签署区信息(设置签署方 盖章/签名/文字输入的区域)
|
||||
EsignSaasSignContractV3DTO.SignField signField = new EsignSaasSignContractV3DTO.SignField();
|
||||
signField.setFileId(flowId);
|
||||
//签章区配置项
|
||||
EsignSaasSignContractV3DTO.NormalSignFieldConfig normalSignFieldConfig = new EsignSaasSignContractV3DTO.NormalSignFieldConfig();
|
||||
normalSignFieldConfig.setAssignedSealId(tmsCollectionAgentWlhyDTO.getEsignSealId());
|
||||
normalSignFieldConfig.setAutoSign(true);
|
||||
normalSignFieldConfig.setSignFieldStyle(1);
|
||||
//签章区样式
|
||||
EsignSaasSignContractV3DTO.SignFieldPosition signFieldPosition = new EsignSaasSignContractV3DTO.SignFieldPosition();
|
||||
signFieldPosition.setPositionPage(thirdInfo.get("esign_agent_page"));
|
||||
signFieldPosition.setPositionX(Float.parseFloat(thirdInfo.get("esign_agent_platex")));
|
||||
signFieldPosition.setPositionY(Float.parseFloat(thirdInfo.get("esign_agent_platey")));
|
||||
normalSignFieldConfig.setSignFieldPosition(signFieldPosition);
|
||||
signField.setNormalSignFieldConfig(normalSignFieldConfig);
|
||||
signer.setSignFields(CollectionUtil.toList(signField));
|
||||
signers.add(signer);
|
||||
|
||||
//通知设置
|
||||
EsignSaasSignContractV3DTO.NoticeConfig noticeConfig = null;
|
||||
if (StringUtils.isNotBlank(thirdInfo.get("esign_agent_notice_types"))){
|
||||
noticeConfig = new EsignSaasSignContractV3DTO.NoticeConfig();
|
||||
noticeConfig.setNoticeTypes("1");
|
||||
}
|
||||
//签署区信息(设置签署方 盖章/签名/文字输入的区域)
|
||||
EsignSaasSignContractV3DTO.SignField signFieldOther = new EsignSaasSignContractV3DTO.SignField();
|
||||
signFieldOther.setFileId(flowId);
|
||||
|
||||
|
||||
|
||||
//其他签署方1(车队长)
|
||||
//签章区配置项
|
||||
EsignSaasSignContractV3DTO.NormalSignFieldConfig normalSignFieldConfigCarrier = new EsignSaasSignContractV3DTO.NormalSignFieldConfig();
|
||||
normalSignFieldConfigCarrier.setSignFieldStyle(1);
|
||||
//车队长
|
||||
EsignSaasSignContractV3DTO.Signer signerCarrier = new EsignSaasSignContractV3DTO.Signer();
|
||||
if (noticeConfig != null) {
|
||||
signerCarrier.setNoticeConfig(noticeConfig);
|
||||
}
|
||||
//签署类型(0-个人,1-企业)
|
||||
signerCarrier.setSignerType(0);
|
||||
//个人签署信息
|
||||
EsignSaasSignContractV3DTO.PsnSignerInfo psnSignerInfoCarrier = new EsignSaasSignContractV3DTO.PsnSignerInfo();
|
||||
psnSignerInfoCarrier.setPsnAccount(tmsCollectionAgentWlhyDTO.getPhoneC());
|
||||
EsignSaasSignContractV3DTO.PsnInfo psnInfoCarrier = new EsignSaasSignContractV3DTO.PsnInfo();
|
||||
psnInfoCarrier.setPsnName(tmsCollectionAgentWlhyDTO.getPartyC());
|
||||
psnSignerInfoCarrier.setPsnInfo(psnInfoCarrier);
|
||||
signerCarrier.setPsnSignerInfo(psnSignerInfoCarrier);
|
||||
//签章区配置项
|
||||
EsignSaasSignContractV3DTO.SignFieldPosition signFieldPositionCarrierr = new EsignSaasSignContractV3DTO.SignFieldPosition();
|
||||
signFieldPositionCarrierr.setPositionPage(thirdInfo.get("esign_agent_page"));
|
||||
signFieldPositionCarrierr.setPositionX(Float.parseFloat(thirdInfo.get("esign_agent_carrierx")));
|
||||
signFieldPositionCarrierr.setPositionY(Float.parseFloat(thirdInfo.get("esign_agent_carriery")));
|
||||
normalSignFieldConfigCarrier.setSignFieldPosition(signFieldPositionCarrierr);
|
||||
signFieldOther.setNormalSignFieldConfig(normalSignFieldConfigCarrier);
|
||||
signerCarrier.setSignFields(CollectionUtil.toList(signFieldOther));
|
||||
EsignSaasSignContractV3DTO.AuthConfig authConfig = new EsignSaasSignContractV3DTO.AuthConfig();
|
||||
List<String> willingnessAuthModes = new ArrayList<>();
|
||||
willingnessAuthModes.add("CODE_SMS");
|
||||
authConfig.setWillingnessAuthModes(willingnessAuthModes);
|
||||
signerCarrier.setAuthConfig(authConfig);
|
||||
signers.add(signerCarrier);
|
||||
esignSaasSignContractV3DTO.setSigners(signers);
|
||||
|
||||
|
||||
//其他签署方2(司机)
|
||||
//签章区配置项
|
||||
EsignSaasSignContractV3DTO.NormalSignFieldConfig normalSignFieldConfigDriver = new EsignSaasSignContractV3DTO.NormalSignFieldConfig();
|
||||
normalSignFieldConfigDriver.setSignFieldStyle(1);
|
||||
//司机
|
||||
EsignSaasSignContractV3DTO.Signer signerDriver = new EsignSaasSignContractV3DTO.Signer();
|
||||
if (noticeConfig != null) {
|
||||
signerDriver.setNoticeConfig(noticeConfig);
|
||||
}
|
||||
//签署类型(0-个人,1-企业)
|
||||
signerDriver.setSignerType(0);
|
||||
//个人签署信息
|
||||
EsignSaasSignContractV3DTO.PsnSignerInfo psnSignerInfoDriver = new EsignSaasSignContractV3DTO.PsnSignerInfo();
|
||||
psnSignerInfoDriver.setPsnAccount(tmsCollectionAgentWlhyDTO.getPhoneB());
|
||||
EsignSaasSignContractV3DTO.PsnInfo psnInfoDriver = new EsignSaasSignContractV3DTO.PsnInfo();
|
||||
psnInfoDriver.setPsnName(tmsCollectionAgentWlhyDTO.getPartyB());
|
||||
psnSignerInfoDriver.setPsnInfo(psnInfoDriver);
|
||||
signerDriver.setPsnSignerInfo(psnSignerInfoDriver);
|
||||
//签章区配置项
|
||||
EsignSaasSignContractV3DTO.SignFieldPosition signFieldPositionDriver = new EsignSaasSignContractV3DTO.SignFieldPosition();
|
||||
signFieldPositionDriver.setPositionPage(thirdInfo.get("esign_agent_page"));
|
||||
signFieldPositionDriver.setPositionX(Float.parseFloat(thirdInfo.get("esign_agent_driverx")));
|
||||
signFieldPositionDriver.setPositionY(Float.parseFloat(thirdInfo.get("esign_agent_drivery")));
|
||||
normalSignFieldConfigDriver.setSignFieldPosition(signFieldPositionDriver);
|
||||
signFieldOther.setNormalSignFieldConfig(normalSignFieldConfigDriver);
|
||||
signerDriver.setSignFields(CollectionUtil.toList(signFieldOther));
|
||||
EsignSaasSignContractV3DTO.AuthConfig authConfigTwo = new EsignSaasSignContractV3DTO.AuthConfig();
|
||||
List<String> willingnessAuthModesTwo = new ArrayList<>();
|
||||
willingnessAuthModesTwo.add("CODE_SMS");
|
||||
authConfigTwo.setWillingnessAuthModes(willingnessAuthModesTwo);
|
||||
signerDriver.setAuthConfig(authConfigTwo);
|
||||
signers.add(signerDriver);
|
||||
esignSaasSignContractV3DTO.setSigners(signers);
|
||||
|
||||
log.info("签署请求参数:"+JSON.toJSONString(esignSaasSignContractV3DTO));
|
||||
//签署
|
||||
R<String> stringR = thirdPartyServiceFeign.signContractByFile(esignSaasSignContractV3DTO);
|
||||
if (R.FAIL == stringR.getCode()) {
|
||||
throw new ServiceException(stringR.getMsg());
|
||||
}
|
||||
return stringR.getData();
|
||||
}
|
||||
|
||||
public boolean feelContractCallBank(JSONObject jsonObject) {
|
||||
log.info("签署完成111:"+jsonObject.toString());
|
||||
String flowStatus = "";
|
||||
String flowId = "";
|
||||
String action = "";
|
||||
try {
|
||||
action = jsonObject.getObj("action").toString();
|
||||
if (!"SIGN_FLOW_COMPLETE".equals(action)){
|
||||
return true;
|
||||
}
|
||||
flowStatus = jsonObject.getObj("signFlowStatus").toString();
|
||||
flowId = jsonObject.getObj("signFlowId").toString();
|
||||
}catch (Exception e){
|
||||
return true;
|
||||
}
|
||||
if (StringUtils.isNotBlank(flowStatus) && flowStatus.equals("2")){
|
||||
// String contractUrl = getContractUrl(flowId);
|
||||
MotorcadeCollection motorcadeCollection = motorcadeCollectionApplicationService.selectByFlowId(flowId);
|
||||
if (motorcadeCollection != null){
|
||||
// motorcadeCollection.setAgreementUrl(contractUrl);
|
||||
motorcadeCollection.setContractStatus(4);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(motorcadeCollection);
|
||||
//此处向消息队列中发送下载签署成功的PDF文件
|
||||
// Map<String,String> sendMap = new HashMap<>();
|
||||
// sendMap.put("flowId",flowId);
|
||||
motorcadeCollectionApplicationService.dowmloadPdf(flowId);
|
||||
|
||||
// String msg = com.alibaba.fastjson.JSONObject.toJSONString(sendMap);
|
||||
// try {
|
||||
// streamBridge.send("rb001usercenter-out-0", msg);
|
||||
// }catch (Exception e){
|
||||
// log.info("rabbitMq请求失败:"+e.getMessage());
|
||||
// }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取地址
|
||||
* @return
|
||||
*/
|
||||
public String getContractUrl(String flowId){
|
||||
//下载已签署文件
|
||||
Map<String, String> mapResult = new HashMap<>();
|
||||
mapResult.put("signFlowId", flowId);
|
||||
R<String> stringR = thirdPartyServiceFeign.downloadSignContract(mapResult);
|
||||
if (R.FAIL == stringR.getCode()) {
|
||||
throw new ServiceException(stringR.getMsg());
|
||||
}
|
||||
return stringR.getData();
|
||||
}
|
||||
|
||||
|
||||
//获取配置参数
|
||||
public Map<String, String> getThirdInfo(Long topOrganization, String interfaceType){
|
||||
//从三方配置表中取值
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setTopOrganizationId(topOrganization);
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType(interfaceType);
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
if (sysDepartInterfaceInfoPos == null || sysDepartInterfaceInfoPos.isEmpty()){
|
||||
throw new ServiceException("当前配置信息获取失败");
|
||||
}
|
||||
Map<String, String> thridInfo = sysDepartInterfaceInfoPos.stream().collect(Collectors.toMap(SysDepartInterfaceInfoPo::getInterfaceTypeKey, SysDepartInterfaceInfoPo::getInterfaceTypeValue));
|
||||
return thridInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取签署页面地址
|
||||
* @return
|
||||
*/
|
||||
public String getSignContractUrl(String flowId, String account){
|
||||
EsignSaasGetSignByFlowIdDTO esignSaasGetSignByFlowIdDTO = new EsignSaasGetSignByFlowIdDTO();
|
||||
esignSaasGetSignByFlowIdDTO.setSignFlowId(flowId);
|
||||
EsignSaasGetSignByFlowIdDTO.Operator operator = new EsignSaasGetSignByFlowIdDTO.Operator();
|
||||
operator.setPsnAccount(account);
|
||||
esignSaasGetSignByFlowIdDTO.setOperator(operator);
|
||||
//获取签署页面链接
|
||||
R<String> stringR = thirdPartyServiceFeign.getSignByFlowId(esignSaasGetSignByFlowIdDTO);
|
||||
if (R.FAIL == stringR.getCode()) {
|
||||
throw new ServiceException(stringR.getMsg());
|
||||
}
|
||||
return stringR.getData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.mhd.common.core.constant.Constants;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.thirdparty.VHisTrack24Po;
|
||||
import com.mhd.common.core.domain.thirdparty.VHisTrack24HisTrack24DTO;
|
||||
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.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import com.mhd.system.api.domain.WlhyLoginUser;
|
||||
import com.mhd.user.domain.appLocation.repository.po.AppLocationPO;
|
||||
import com.mhd.user.domain.appLocation.repository.po.TmsVehicleLocationVO;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
import com.mhd.user.domain.appLocation.service.AppLocationDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.service.DriverCurrentPositionDomainService;
|
||||
import com.mhd.user.domain.userAggregate.entity.DriverVehicleBind;
|
||||
import com.mhd.user.interfaces.dto.AppLocationDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* APP位置信息ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppLocationApplicationService {
|
||||
@Autowired
|
||||
private AppLocationDomainService appLocationDomainService;
|
||||
@Autowired
|
||||
private DriverCurrentPositionDomainService driverCurrentPositionDomainService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Resource
|
||||
private WlhyServiceFeign wlhyServiceFeign;
|
||||
@Autowired
|
||||
private DriverVehicleBindApplicationService driverVehicleBindApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询APP位置信息列表
|
||||
*/
|
||||
|
||||
public List<AppLocationPO> queryList(AppLocationDO appLocationDO) {
|
||||
return appLocationDomainService.queryList(appLocationDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增APP位置信息
|
||||
*/
|
||||
public Boolean insert(AppLocationDO appLocationDO) {
|
||||
|
||||
return appLocationDomainService.insert(appLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP位置信息
|
||||
*/
|
||||
public Boolean update(AppLocationDO appLocationDO) {
|
||||
return appLocationDomainService.update(appLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除APP位置信息
|
||||
*/
|
||||
public boolean delete(Long[] appLocationIds) {
|
||||
return appLocationDomainService.delete(appLocationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP位置信息详细信息
|
||||
*/
|
||||
public AppLocationPO getInfo(Long appLocationId)
|
||||
{
|
||||
return appLocationDomainService.getInfo(appLocationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* app打点
|
||||
* @param appLocationDO
|
||||
* @return
|
||||
*/
|
||||
public boolean appRunBatted(AppLocationDO appLocationDO) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
WlhyLoginUser wlhyLoginUser = loginUser.getWlhyLoginUser();
|
||||
if (null == loginUser){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
System.out.println(new Date() + "===app定位消息==="+appLocationDO.getCreateByName()+",经度="+appLocationDO.getLongitude()+",维度="+appLocationDO.getLatitude());
|
||||
appLocationDO.setUserId(loginUser.getUserid());
|
||||
String waybillNo = "";
|
||||
String licensePlate = "";
|
||||
//唯一标识(指定key + 消息头)
|
||||
if (wlhyLoginUser != null){
|
||||
String waybillNoKey = Constants.APP_LOCATION_WAYBILL_NO + wlhyLoginUser.getId();
|
||||
String licensePlateKey = Constants.APP_LOCATION_LICENSE_PLATE_NUMBER + wlhyLoginUser.getId();
|
||||
waybillNo = redisService.getCacheObject(waybillNoKey);
|
||||
licensePlate = redisService.getCacheObject(licensePlateKey);
|
||||
if (StringUtils.isNotEmpty(licensePlate)){
|
||||
appLocationDO.setLicensePlate(licensePlate);
|
||||
}else {
|
||||
//缓存没有查询网货
|
||||
R<String> vehicleLicenseNumberBylogin = wlhyServiceFeign.getVehicleLicenseNumberBylogin();
|
||||
if (vehicleLicenseNumberBylogin.getCode() == R.SUCCESS){
|
||||
appLocationDO.setLicensePlate(vehicleLicenseNumberBylogin.getData());
|
||||
//唯一标识(指定key + 消息头)
|
||||
redisService.setCacheObject(licensePlateKey, vehicleLicenseNumberBylogin.getData());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(waybillNo)){
|
||||
appLocationDO.setWaybillNum(waybillNo);
|
||||
}else {
|
||||
//缓存没有查询网货
|
||||
R<String> waybillNoResult = wlhyServiceFeign.selectByDriverId();
|
||||
if (waybillNoResult.getCode() == R.SUCCESS){
|
||||
appLocationDO.setWaybillNum(waybillNoResult.getData());
|
||||
//唯一标识(指定key + 消息头)
|
||||
redisService.setCacheObject(waybillNoKey, waybillNoResult.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(licensePlate)){
|
||||
DriverVehicleBind bindUseInfoByUserId = driverVehicleBindApplicationService.getBindUseInfoByUserId(loginUser.getUserPo().getUserId());
|
||||
if (bindUseInfoByUserId != null){
|
||||
licensePlate = bindUseInfoByUserId.getVehicleLicensePlateNumber();
|
||||
}
|
||||
}
|
||||
appLocationDO.setLicensePlate(licensePlate);
|
||||
appLocationDomainService.insert(appLocationDO);
|
||||
//在司机当前位置信息插入一条数据信息
|
||||
DriverCurrentPositionDO driverCurrentPositionDO = new DriverCurrentPositionDO();
|
||||
BeanUtils.copyProperties(appLocationDO, driverCurrentPositionDO);
|
||||
driverCurrentPositionDO.setLicensePlate(licensePlate);
|
||||
driverCurrentPositionDomainService.insert(driverCurrentPositionDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<TmsVehicleLocationVO> qurtyByTime(AppLocationDO appLocationDO) {
|
||||
List<TmsVehicleLocationVO> list = new ArrayList<>();
|
||||
if( 0 == appLocationDO.getType()) {
|
||||
if(StringUtils.isBlank(appLocationDO.getLicensePlate())){
|
||||
throw new ServiceException("请输入车牌号");
|
||||
}
|
||||
appLocationDO.setWaybillNum("");//不关联运单号查询
|
||||
List<AppLocationPO> appLocationPOS = appLocationDomainService.queryList(appLocationDO);
|
||||
if (appLocationPOS != null && !appLocationPOS.isEmpty()){
|
||||
for (AppLocationPO appLocationPO : appLocationPOS) {
|
||||
TmsVehicleLocationVO tmsVehicleLocationVO = new TmsVehicleLocationVO();
|
||||
tmsVehicleLocationVO.setAddress(appLocationPO.getAddress());
|
||||
tmsVehicleLocationVO.setLatitude(appLocationPO.getLatitude());
|
||||
tmsVehicleLocationVO.setLongitude(appLocationPO.getLongitude());
|
||||
tmsVehicleLocationVO.setVehicleLicenseNumber(appLocationPO.getLicensePlate());
|
||||
tmsVehicleLocationVO.setTransportationNumber(appLocationPO.getWaybillNum());
|
||||
tmsVehicleLocationVO.setCreateTime(appLocationPO.getCreateTime());
|
||||
list.add(tmsVehicleLocationVO);
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("未查询到轨迹");
|
||||
}
|
||||
}
|
||||
//中交行路
|
||||
else if(1 == appLocationDO.getType()) {
|
||||
VHisTrack24HisTrack24DTO vHisTrack24HisTrack24DTO = new VHisTrack24HisTrack24DTO();
|
||||
vHisTrack24HisTrack24DTO.setVco("2");
|
||||
vHisTrack24HisTrack24DTO.setVclN(appLocationDO.getLicensePlate());
|
||||
vHisTrack24HisTrack24DTO.setQryBtm(appLocationDO.getStartTime());
|
||||
vHisTrack24HisTrack24DTO.setQryEtm(appLocationDO.getEndTime());
|
||||
// vHisTrack24HisTrack24DTO.setVco("2");
|
||||
// vHisTrack24HisTrack24DTO.setVclN("陕YH0008");
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.vHisTrack24s(vHisTrack24HisTrack24DTO);
|
||||
List<VHisTrack24Po> list1;
|
||||
if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
list1 = JSONUtil.toList(JSONObject.toJSONString(ajaxResult.get("data")), VHisTrack24Po.class);
|
||||
} else {
|
||||
throw new ServiceException("未查询到轨迹");
|
||||
}
|
||||
if (CollUtil.isEmpty(list1)) {
|
||||
throw new ServiceException("获取失败");
|
||||
}
|
||||
for (VHisTrack24Po vHisTrack24Po : list1) {
|
||||
TmsVehicleLocationVO tmsVehicleLocationVO = new TmsVehicleLocationVO();
|
||||
//获取的经纬度 ---格式处理
|
||||
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date dateTime = null;
|
||||
String gtm = vHisTrack24Po.getGtm();
|
||||
String str = "";
|
||||
str = gtm.substring(0,4)+"-"+gtm.substring(4,6)+"-"+gtm.substring(6,8)+" "+gtm.substring(9,11)+":"+gtm.substring(11,13)+":"+gtm.substring(13,15);
|
||||
try {
|
||||
dateTime = format1.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
tmsVehicleLocationVO.setCreateTime(dateTime);
|
||||
tmsVehicleLocationVO.setLatitude(vHisTrack24Po.getLat().toString());
|
||||
tmsVehicleLocationVO.setLongitude(vHisTrack24Po.getLon().toString());
|
||||
list.add(tmsVehicleLocationVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+316
@@ -0,0 +1,316 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
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.common.core.exception.ServiceException;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDataPermissionDO;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDataPermissionDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.user.infrastructure.feign.SystemServiceFeign;
|
||||
|
||||
import com.mhd.common.core.constant.CacheConstants;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserDataPermissionPO;
|
||||
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.enums.RoleEnum;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.oss.configure.OSSClientPrivateUtil;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.redis.service.RedisService;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 公共 应用服务层
|
||||
* <p>
|
||||
* 本层可以综合应用各种业务间的组合
|
||||
* <p>
|
||||
* 2023-02-20
|
||||
*
|
||||
* @author 王子豪
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CommonApplicationService {
|
||||
|
||||
@Resource
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
@Resource
|
||||
private UserDomainService userDomainService;
|
||||
|
||||
@Resource
|
||||
private UserDataPermissionDomainService userDataPermissionDomainService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 判断当前登录人的数据权限
|
||||
*/
|
||||
public UserDataPermissionQueryDTO dataPermission(Long permissionMenuId) {
|
||||
UserDataPermissionQueryDTO dataPermission = new UserDataPermissionQueryDTO();
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// LoginUser loginUser = new LoginUser();
|
||||
Long userId = new Long("19");
|
||||
Long organizationId = new Long("2");
|
||||
// if(1 == 1){
|
||||
if (loginUser.getUserPo() != null) {
|
||||
userId = loginUser.getUserid();
|
||||
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.setPermissionOrganizationIds(longs);
|
||||
}
|
||||
} else {
|
||||
//获取当前用户数据权限
|
||||
UserDataPermissionDO userDataPermissionQueryDTO = new UserDataPermissionDO();
|
||||
userDataPermissionQueryDTO.setMenuId(permissionMenuId);
|
||||
userDataPermissionQueryDTO.setOrganizationId(organizationId);
|
||||
userDataPermissionQueryDTO.setUserId(userId);
|
||||
UserDataPermissionPO userDataPermissionPO = userDataPermissionDomainService.findUserDataPermission(userDataPermissionQueryDTO);
|
||||
if (userDataPermissionPO!=null && userDataPermissionPO.getUserDataOrganizationStatus() != null) {
|
||||
//1表示可以查询当前组织及下级组织的数据,反之只能看到自己创建的数据
|
||||
if (userDataPermissionPO.getUserDataOrganizationStatus() == 1) {
|
||||
Long topOrganizationId = new Long("2");
|
||||
//获取当前组织最上级
|
||||
AjaxResult topId = productServiceFeign.getTopOrganization(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.setPermissionOrganizationIds(longs);
|
||||
}
|
||||
} else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
} else {
|
||||
dataPermission.setCreateBy(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataPermission;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户 user 校验登录账号/手机号唯一性
|
||||
*
|
||||
* @param userDO
|
||||
*/
|
||||
public void checkAccountInfo(UserDO userDO) {
|
||||
//获取当前登录用户的最高组织
|
||||
Long topOrganizationId = SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId();
|
||||
|
||||
checkUserInfo(topOrganizationId, userDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户 user 校验登录账号/手机号唯一性
|
||||
*
|
||||
* @param userDO
|
||||
*/
|
||||
public void checkAccountInfoByOpen(UserDO userDO) {
|
||||
//获取最高组织
|
||||
Long topOrganizationId = userDO.getTopOrganizationId();
|
||||
if (ObjectUtil.isNull(topOrganizationId)){
|
||||
throw new ServiceException("检验账号,获取当前最高最高组织失败");
|
||||
}
|
||||
|
||||
checkUserInfo(topOrganizationId, userDO);
|
||||
}
|
||||
|
||||
public void checkUserInfo(Long topOrganizationId,UserDO userDO){
|
||||
//根据账号查询
|
||||
UserPo userPo = null;
|
||||
if (StrUtil.isNotEmpty(userDO.getUserAccount())) {
|
||||
UserDO queryAccount = new UserDO();
|
||||
queryAccount.setTopOrganizationId(topOrganizationId);
|
||||
queryAccount.setUserAccount(userDO.getUserAccount());
|
||||
userPo = userDomainService.findByTopOrganizationIdAndUserAccount(queryAccount);
|
||||
}
|
||||
//根据手机号查询
|
||||
UserPo userPoTwo = null;
|
||||
if (StrUtil.isNotEmpty(userDO.getUserPhone())) {
|
||||
UserDO queryPhone = new UserDO();
|
||||
queryPhone.setTopOrganizationId(topOrganizationId);
|
||||
queryPhone.setUserPhone(userDO.getUserPhone());
|
||||
userPoTwo = userDomainService.findByTopOrganizationIdAndUserPhone(queryPhone);
|
||||
}
|
||||
//根据身份证号查询
|
||||
UserPo userPoThree = null;
|
||||
if (StringUtils.isNotBlank(userDO.getUserIdcardNumber())) {
|
||||
UserDO queryIdcard = new UserDO();
|
||||
queryIdcard.setTopOrganizationId(topOrganizationId);
|
||||
queryIdcard.setUserIdcardNumber(userDO.getUserIdcardNumber());
|
||||
userPoThree = userDomainService.findByTopOrganizationIdAndIdCard(queryIdcard);
|
||||
}
|
||||
//根据推广码查询
|
||||
UserPo userPoFour = null;
|
||||
if (StringUtils.isNotBlank(userDO.getPromoCode())){
|
||||
UserDO queryPromoCode = new UserDO();
|
||||
queryPromoCode.setPromoCode(userDO.getPromoCode());
|
||||
userPoFour = userDomainService.findByPromoCode(queryPromoCode);
|
||||
}
|
||||
//用户id不为空,则说明是编辑操作
|
||||
if (userDO.getUserId() != null) {
|
||||
//对比查询到的userid是否为同一个,如果不是同一个,则无法修改
|
||||
if (null != userPo && !Objects.equals(userDO.getUserId(), userPo.getUserId())) {
|
||||
throw new DigitalLogisticsException(UserError.USER_ACCOUNT_EXIST);
|
||||
}
|
||||
if (null != userPoTwo && !Objects.equals(userDO.getUserId(), userPoTwo.getUserId())) {
|
||||
throw new DigitalLogisticsException(UserError.USER_PHONE_EXIST);
|
||||
}
|
||||
if (null != userPoThree && !Objects.equals(userDO.getUserIdcardNumber(), userPoThree.getUserIdcardNumber())) {
|
||||
throw new DigitalLogisticsException(UserError.USER_IDCARD_EXIST);
|
||||
}
|
||||
if (null != userPoFour && !Objects.equals(userDO.getPromoCode(), userPoFour.getPromoCode())) {
|
||||
throw new DigitalLogisticsException(UserError.PROMO_CODE_EXIST);
|
||||
}
|
||||
} else {
|
||||
//为空,则说明是新增操作
|
||||
if (userPo != null && userPo.getUserId() != null) {
|
||||
throw new DigitalLogisticsException(UserError.USER_ACCOUNT_EXIST);
|
||||
}
|
||||
if (userPoTwo != null && userPoTwo.getUserId() != null) {
|
||||
throw new DigitalLogisticsException(UserError.USER_PHONE_EXIST);
|
||||
}
|
||||
if (userPoThree != null && userPoThree.getUserId() != null) {
|
||||
throw new DigitalLogisticsException(UserError.USER_IDCARD_EXIST);
|
||||
}
|
||||
if (userPoFour != null && userPoFour.getUserId() != null) {
|
||||
throw new DigitalLogisticsException(UserError.PROMO_CODE_EXIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description List<Object>对象获取解密图片信息
|
||||
* @Author Alex
|
||||
* @Date 2023/5/4 10:26
|
||||
*/
|
||||
public List<Object> getObjectlistSignPrivateURL(List<Object> objectList) {
|
||||
//查询三方接口信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("oss_upload");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoList = thirdPartyServiceFeign.querylist(sysDepartInterfaceInfoDTO);
|
||||
objectList = OSSClientPrivateUtil.preListObjectSignPrivateURL(objectList, sysDepartInterfaceInfoPoList);
|
||||
return objectList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description Object对象获取解密图片信息
|
||||
* @Author Alex
|
||||
* @Date 2023/5/4 10:26
|
||||
*/
|
||||
public Object getObjectSignPrivateURL(Object obj) {
|
||||
//查询三方接口信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("oss_upload");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoList = thirdPartyServiceFeign.querylist(sysDepartInterfaceInfoDTO);
|
||||
obj = OSSClientPrivateUtil.preObjectSignPrivateURL(obj, sysDepartInterfaceInfoPoList);
|
||||
|
||||
/*objectList = OSSClientPrivateUtil.preListObjectSignPrivateURL(Collections.singletonList(userDriverPoList),sysDepartInterfaceInfoPoList);
|
||||
for(UserDriverPo userDriverPo : userDriverPoList){
|
||||
//解密图片
|
||||
Object obj = OSSClientPrivateUtil.preObjectSignPrivateURL(userDriverPo,sysDepartInterfaceInfoPoList);
|
||||
userDriverPo = new ObjectMapper().convertValue(obj, UserDriverPo.class);
|
||||
}*/
|
||||
return obj;
|
||||
}
|
||||
|
||||
public List<Object> beanToObject(List<?> t) {
|
||||
List<Object> o = new ArrayList<>();
|
||||
Iterator<?> it = t.iterator();
|
||||
while (it.hasNext()) {
|
||||
o.add(it.next());
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description Object对象获取解密图片信息
|
||||
* @Author Alex
|
||||
* @Date 2023/5/4 10:26
|
||||
*/
|
||||
public void deleteOssResource(Object oldObj, Object newObj) {
|
||||
//查询三方接口信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("oss_upload");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoList = thirdPartyServiceFeign.querylist(sysDepartInterfaceInfoDTO);
|
||||
OSSClientPrivateUtil.deleteOssResource(oldObj, newObj, sysDepartInterfaceInfoPoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 从oss删除对象中所有的文件
|
||||
* @Author Alex
|
||||
* @Date 2023/5/4 10:26
|
||||
*/
|
||||
public void deleteAllOssResource(Object oldObj) {
|
||||
//查询三方接口信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("oss_upload");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoList = thirdPartyServiceFeign.querylist(sysDepartInterfaceInfoDTO);
|
||||
OSSClientPrivateUtil.deleteAllOssResource(oldObj, sysDepartInterfaceInfoPoList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户所在组织的开关配置信息
|
||||
* @return
|
||||
*/
|
||||
public UserConfigSwitchPo getUserConfigSwitch() {
|
||||
//获取登录人信息
|
||||
UserConfigSwitchPo userConfigSwitchPo;
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
Long organizationId = userPo.getOrganizationId();
|
||||
userConfigSwitchPo = redisService.getCacheObject(CacheConstants.USER_COMFIG_SWITCH_KEY + organizationId);
|
||||
if(null == userConfigSwitchPo || userConfigSwitchPo.getUserConfigSwitchId() == null){
|
||||
//查询数据库,并且存到redis中
|
||||
AjaxResult ajaxResult = systemServiceFeign.getUserConfigSwitchInfo();
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
userConfigSwitchPo = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserConfigSwitchPo.class);
|
||||
if(null != userConfigSwitchPo){
|
||||
//存入redis中
|
||||
redisService.setCacheObject(CacheConstants.USER_COMFIG_SWITCH_KEY + organizationId ,userConfigSwitchPo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return userConfigSwitchPo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.thirdparty.RegeocodesAddressPo;
|
||||
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.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.domain.DriverCurrentPositionPO;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.service.DriverCurrentPositionDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 司机当前位置信息ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DriverCurrentPositionApplicationService {
|
||||
@Autowired
|
||||
private DriverCurrentPositionDomainService driverCurrentPositionDomainService;
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
@Autowired
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询司机当前位置信息列表
|
||||
*/
|
||||
|
||||
public List<DriverCurrentPositionPO> queryList(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
return driverCurrentPositionDomainService.queryList(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增司机当前位置信息
|
||||
*/
|
||||
public Boolean insert(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
|
||||
return driverCurrentPositionDomainService.insert(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机当前位置信息
|
||||
*/
|
||||
public Boolean update(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
return driverCurrentPositionDomainService.update(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除司机当前位置信息
|
||||
*/
|
||||
public boolean delete(Long[] driverCurrentPositionIds) {
|
||||
return driverCurrentPositionDomainService.delete(driverCurrentPositionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机当前位置信息详细信息
|
||||
*/
|
||||
public DriverCurrentPositionPO getInfo(Long driverCurrentPositionId)
|
||||
{
|
||||
return driverCurrentPositionDomainService.getInfo(driverCurrentPositionId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取司机的最新位置信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public DriverCurrentPositionPO getDriverLatestLocation(Long userId) {
|
||||
UserPo userPo = userDomainService.selectByUserId(userId);
|
||||
DriverCurrentPositionPO driverCurrentPositionPO = driverCurrentPositionDomainService.getDriverLatestLocation(userId);
|
||||
if (driverCurrentPositionPO == null){
|
||||
throw new ServiceException("暂未获取司机当前位置");
|
||||
}
|
||||
long minute = DateUtil.between(driverCurrentPositionPO.getCreateTime(), DateUtil.date(), DateUnit.MINUTE, false);
|
||||
String driverStatus = "在线";//在线
|
||||
if (minute > 60) {
|
||||
driverStatus = "离线";//离线
|
||||
}
|
||||
driverCurrentPositionPO.setDriverStatus(driverStatus);
|
||||
String[] position = {driverCurrentPositionPO.getLongitude(), driverCurrentPositionPO.getLatitude()};
|
||||
driverCurrentPositionPO.setPosition(position);
|
||||
String lnglat = driverCurrentPositionPO.getLongitude() + "," + driverCurrentPositionPO.getLatitude();
|
||||
R<List<RegeocodesAddressPo>> result = thirdPartyServiceFeign.regeo(lnglat);
|
||||
if (R.SUCCESS == result.getCode()) {
|
||||
List<RegeocodesAddressPo> xsgjcsdqh= result.getData();
|
||||
if (!xsgjcsdqh.isEmpty()){
|
||||
driverCurrentPositionPO.setAddress(xsgjcsdqh.get(0).getFormattedAddress());
|
||||
}
|
||||
}
|
||||
|
||||
if (userPo != null){
|
||||
driverCurrentPositionPO.setUserName(userPo.getUserName());
|
||||
driverCurrentPositionPO.setUserPhone(userPo.getUserPhone());
|
||||
}
|
||||
return driverCurrentPositionPO;
|
||||
}
|
||||
|
||||
public DriverCurrentPositionPO getVehicleLicensePlate(String licensePlate) {
|
||||
DriverCurrentPositionPO driverCurrentPositionPO = driverCurrentPositionDomainService.getVehicleLatestLocation(licensePlate);
|
||||
if (driverCurrentPositionPO == null){
|
||||
throw new ServiceException("暂未获取司机当前位置");
|
||||
}
|
||||
long minute = DateUtil.between(driverCurrentPositionPO.getCreateTime(), DateUtil.date(), DateUnit.MINUTE, false);
|
||||
String driverStatus = "在线";//在线
|
||||
if (minute > 30) {
|
||||
driverStatus = "离线";//离线
|
||||
}
|
||||
driverCurrentPositionPO.setDriverStatus(driverStatus);
|
||||
String[] position = {driverCurrentPositionPO.getLongitude(), driverCurrentPositionPO.getLatitude()};
|
||||
driverCurrentPositionPO.setPosition(position);
|
||||
String lnglat = driverCurrentPositionPO.getLongitude() + "," + driverCurrentPositionPO.getLatitude();
|
||||
R<List<RegeocodesAddressPo>> result = thirdPartyServiceFeign.regeo(lnglat);
|
||||
if (R.SUCCESS == result.getCode()) {
|
||||
List<RegeocodesAddressPo> xsgjcsdqh= result.getData();
|
||||
if (!xsgjcsdqh.isEmpty()){
|
||||
driverCurrentPositionPO.setAddress(xsgjcsdqh.get(0).getFormattedAddress());
|
||||
}
|
||||
}
|
||||
return driverCurrentPositionPO;
|
||||
}
|
||||
|
||||
public List<Long> getOnlineDriver() {
|
||||
//获取配置信息
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setTopOrganizationId(1L);
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("applocation");
|
||||
Integer minutes = 30;
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
if (CollUtil.isNotEmpty(sysDepartInterfaceInfoPos)) {
|
||||
String interfaceTypeValue = sysDepartInterfaceInfoPos.get(0).getInterfaceTypeValue();
|
||||
if (StringUtils.isNotBlank(interfaceTypeValue)){
|
||||
minutes = Integer.parseInt(interfaceTypeValue);
|
||||
}
|
||||
}
|
||||
Calendar nowTime = Calendar.getInstance();
|
||||
nowTime.add(Calendar.MINUTE, -minutes);
|
||||
Date time = nowTime.getTime();
|
||||
|
||||
List<Long> list = driverCurrentPositionDomainService.getOnlineDriver(time);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<DriverCurrentPositionPO> getOnlineVehicle() {
|
||||
Calendar nowTime = Calendar.getInstance();
|
||||
nowTime.add(Calendar.MINUTE, -30);
|
||||
Date time = nowTime.getTime();
|
||||
List<DriverCurrentPositionPO> list = driverCurrentPositionDomainService.getOnlineVehicle(time);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<DriverCurrentPositionPO> getOfflineVehicle() {
|
||||
Calendar nowTime = Calendar.getInstance();
|
||||
nowTime.add(Calendar.MINUTE, -30);
|
||||
Date time = nowTime.getTime();
|
||||
List<DriverCurrentPositionPO> list = driverCurrentPositionDomainService.getOfflineVehicle(time);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
import com.mhd.user.domain.driverFollowShipper.service.DriverFollowShipperDomainService;
|
||||
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 2023-12-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DriverFollowShipperApplicationService {
|
||||
@Autowired
|
||||
private DriverFollowShipperDomainService driverFollowShipperDomainService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车主关注货主列表
|
||||
*/
|
||||
|
||||
public List<DriverFollowShipperPO> queryList(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
driverFollowShipperDO.setDriverUserId(loginUser.getUserid());
|
||||
return driverFollowShipperDomainService.queryList(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车主关注货主
|
||||
*/
|
||||
public Boolean insert(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
|
||||
return driverFollowShipperDomainService.insert(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车主关注货主
|
||||
*/
|
||||
public Boolean update(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
return driverFollowShipperDomainService.update(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车主关注货主
|
||||
*/
|
||||
public boolean delete(Long[] driverFollowShipperIds) {
|
||||
return driverFollowShipperDomainService.delete(driverFollowShipperIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车主关注货主详细信息
|
||||
*/
|
||||
public DriverFollowShipperPO getInfo(Long driverFollowShipperId)
|
||||
{
|
||||
return driverFollowShipperDomainService.getInfo(driverFollowShipperId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车主关注货主/取消关注
|
||||
* @param driverFollowShipperDO
|
||||
* @return
|
||||
*/
|
||||
public boolean operateFollow(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if(driverFollowShipperDO.getShipperUserId()==null){
|
||||
throw new ServiceException("货主用户id不能为空");
|
||||
}
|
||||
driverFollowShipperDO.setDriverUserId(loginUser.getUserid());
|
||||
if(driverFollowShipperDO.getFollowType()==1){
|
||||
//用户关注操作
|
||||
driverFollowShipperDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
driverFollowShipperDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
driverFollowShipperDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
return driverFollowShipperDomainService.insert(driverFollowShipperDO);
|
||||
}else if(driverFollowShipperDO.getFollowType()==2){
|
||||
//用户取消关注操作
|
||||
return driverFollowShipperDomainService.deleteByShipperUserId(driverFollowShipperDO.getShipperUserId(),driverFollowShipperDO.getDriverUserId());
|
||||
}else {
|
||||
throw new ServiceException("操作类型错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
package com.mhd.user.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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.mhd.user.domain.userAggregate.entity.DriverVehicleBind;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.DriverVehicleBindPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.DriverVehicleBindDo;
|
||||
import com.mhd.user.domain.userAggregate.service.DriverVehicleBindDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
||||
import com.mhd.system.api.TransportFeign;
|
||||
import com.mhd.user.interfaces.dto.DriverVehicleBindDto;
|
||||
import com.mhd.user.interfaces.facadeApi.Po.VehicleDriverBindAppPo;
|
||||
import com.mhd.common.core.domain.dto.VehicleDto;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
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.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.mhd.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 司机车辆绑定关系ApplicationService
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-18
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DriverVehicleBindApplicationService {
|
||||
@Autowired
|
||||
private DriverVehicleBindDomainService driverVehicleBindDomainService;
|
||||
@Autowired
|
||||
private TransportFeign transportFeign;
|
||||
@Resource
|
||||
private CommonApplicationService commonApplicationService;
|
||||
@Resource
|
||||
private UserDriverDomainService userDriverDomainService;
|
||||
/**
|
||||
* 分页查询司机车辆绑定关系列表
|
||||
*/
|
||||
|
||||
public List<DriverVehicleBindPo> queryList(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
driverVehicleBindDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return driverVehicleBindDomainService.queryList(driverVehicleBindDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据司机id查询绑定车辆的用户信息
|
||||
*/
|
||||
public Map<String,String> selectUserBindByVehicleId(Long vehicleId){
|
||||
return driverVehicleBindDomainService.selectUserBindByVehicleId(vehicleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或更新绑定关系
|
||||
* @param driverVehicleBindDo
|
||||
* @return
|
||||
*/
|
||||
public Boolean saveOrUpdate(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
if(driverVehicleBindDo.getDriverVehicleBindId()!=null){
|
||||
return driverVehicleBindDomainService.update(driverVehicleBindDo);
|
||||
}else {
|
||||
return driverVehicleBindDomainService.insert(driverVehicleBindDo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增司机车辆绑定关系
|
||||
*/
|
||||
public Boolean insert(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
return driverVehicleBindDomainService.insert(driverVehicleBindDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机车辆绑定关系
|
||||
*/
|
||||
public Boolean update(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
return driverVehicleBindDomainService.update(driverVehicleBindDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除司机车辆绑定关系
|
||||
*/
|
||||
public Boolean delete(Long[] driverVehicleBindIds) {
|
||||
return driverVehicleBindDomainService.delete(driverVehicleBindIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机车辆绑定关系详细信息
|
||||
*/
|
||||
public DriverVehicleBindPo getInfo(Long driverVehicleBindId)
|
||||
{
|
||||
return driverVehicleBindDomainService.getInfo(driverVehicleBindId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP我的车辆列表查询
|
||||
*/
|
||||
public List<DriverVehicleBindPo> driverBindCarList(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
/*
|
||||
此处查询需要关联车辆表,车辆表与司机表不在同一中台,所以在进行查询时,需要使用fegn调用
|
||||
角色类型:我是车主-只查询自己创建的车辆;我是驾驶员-查询自己创建的车辆以及自己绑定的车辆
|
||||
*/
|
||||
//首先查询当前登录用户,承运人绑定的车辆
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
//查询司机信息
|
||||
UserDriverPo userDriverPo = userDriverDomainService.selectByUserId(userId);
|
||||
if(null == userDriverPo){
|
||||
throw new ServiceException("未找到当前司机信息");
|
||||
}
|
||||
driverVehicleBindDo.setDriverBindId(userDriverPo.getUserId());
|
||||
startPage();
|
||||
List<DriverVehicleBindPo> driverVehicleBindPoList = driverVehicleBindDomainService.queryList(driverVehicleBindDo);
|
||||
if(driverVehicleBindPoList!=null && driverVehicleBindPoList.size()>0){
|
||||
//循环查询的车辆信息,补全车辆信息
|
||||
List<Long> vehicleIds = driverVehicleBindPoList.stream().map(DriverVehicleBindPo::getVehicleId).collect(Collectors.toList());
|
||||
VehicleDto vehicleDto = new VehicleDto();
|
||||
vehicleDto.setVehicleIdList(vehicleIds);
|
||||
AjaxResult vehicleInfo = transportFeign.getVehicleByIds(vehicleDto);
|
||||
List<VehiclePo> vehiclePoList = new ArrayList<>();
|
||||
if("200".equals(String.valueOf(vehicleInfo.get("code")))){
|
||||
vehiclePoList = JSON.parseArray(JSONObject.toJSONString(vehicleInfo.get("data")), VehiclePo.class);
|
||||
}
|
||||
if(vehiclePoList.size()>0){
|
||||
for (DriverVehicleBindPo driverVehicleBindPo : driverVehicleBindPoList) {
|
||||
VehiclePo vehiclePo = vehiclePoList.stream().filter(item-> ObjectUtil.equal(driverVehicleBindPo.getVehicleId(),item.getVehicleId())).findAny().orElse(null);
|
||||
if(null != vehiclePo){
|
||||
driverVehicleBindPo.setAuthenticationStatus(vehiclePo.getAuthenticationStatus());
|
||||
driverVehicleBindPo.setVehicleTypeName(vehiclePo.getVehicleTypeName());
|
||||
driverVehicleBindPo.setVehicleApprovedLoadQuantity(vehiclePo.getVehicleApprovedLoadQuantity());
|
||||
driverVehicleBindPo.setOtherHeadstockImage(vehiclePo.getOtherHeadstockImage());
|
||||
driverVehicleBindPo.setOtherLicensePlateColorId(vehiclePo.getOtherLicensePlateColorId());
|
||||
driverVehicleBindPo.setOtherLicensePlateColorName(vehiclePo.getOtherLicensePlateColorName());
|
||||
driverVehicleBindPo.setRejectReason(vehiclePo.getRejectReason());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return driverVehicleBindPoList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据车辆id和userid查询车辆绑定信息
|
||||
* @param vehicleId
|
||||
* @return
|
||||
*/
|
||||
public DriverVehicleBindPo getInfoByVehicle(Long vehicleId,Long userId) {
|
||||
return driverVehicleBindDomainService.getInfoByVehicle(vehicleId,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用mybatils函数更新,可set null
|
||||
* @param updateWrapper
|
||||
*/
|
||||
public Boolean updateByMybatis(LambdaUpdateWrapper<DriverVehicleBind> updateWrapper) {
|
||||
return driverVehicleBindDomainService.updateByMybatis(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用mybatils函数删除
|
||||
* @param updateWrapper
|
||||
* @return
|
||||
*/
|
||||
public Boolean removeById(LambdaUpdateWrapper<DriverVehicleBind> updateWrapper) {
|
||||
return driverVehicleBindDomainService.removeById(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定车辆列表
|
||||
* @param driverVehicleBindDo
|
||||
* @return
|
||||
*/
|
||||
public List<DriverVehicleBindPo> queryBindCarList(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
/*
|
||||
根据当前司机id,查询该司机创建的车辆,以及绑定的车辆
|
||||
*/
|
||||
if(driverVehicleBindDo.getUserId()==null){
|
||||
throw new ServiceException("司机信息不能为空");
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车辆id查询司机
|
||||
*/
|
||||
public Map<Long, List<String>> getInfoByVid(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
throw new ServiceException("ids不能为空");
|
||||
}
|
||||
List<DriverVehicleBind> infoByVid = driverVehicleBindDomainService.getInfoByVid(ids);
|
||||
|
||||
return infoByVid.stream()
|
||||
.collect(Collectors.groupingBy(DriverVehicleBind::getVehicleId, Collectors.mapping(DriverVehicleBind::getBindDriverName, Collectors.toList())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车辆id查询司机
|
||||
*/
|
||||
public List<DriverVehicleBind> getListByVid(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
throw new ServiceException("ids不能为空");
|
||||
}
|
||||
List<DriverVehicleBind> infoByVid = driverVehicleBindDomainService.getInfoByVid(ids);
|
||||
|
||||
return infoByVid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车辆id查询司机
|
||||
*/
|
||||
public List<DriverVehicleBind> getBindListByVid(Long id) {
|
||||
return driverVehicleBindDomainService.getInfoByVid(id);
|
||||
}
|
||||
|
||||
public DriverVehicleBind getBindInfoListByVehicle(Long vehicleId, Long userId) {
|
||||
return driverVehicleBindDomainService.getBindInfoListByVehicle(vehicleId, userId);
|
||||
}
|
||||
|
||||
public List<DriverVehicleBind> getBindInfoListByVehicle(Long vehicleId) {
|
||||
return driverVehicleBindDomainService.getBindInfoListByVehicle(vehicleId);
|
||||
}
|
||||
|
||||
public List<DriverVehicleBind> getBindInfoListByDriverId(Long vehicleId) {
|
||||
return driverVehicleBindDomainService.getBindInfoListByDriverId(vehicleId);
|
||||
}
|
||||
|
||||
public DriverVehicleBind getBindUseInfoByUserId(Long userId) {
|
||||
return driverVehicleBindDomainService.getBindUseInfoByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车辆信息,查询车辆绑定关系信息
|
||||
*/
|
||||
public List<VehicleDriverBindAppPo> queryVehicleBindInfo(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
List<VehicleDriverBindAppPo> driverInfoList = driverVehicleBindDomainService.queryVehicleBindInfo(driverVehicleBindDo);
|
||||
for (VehicleDriverBindAppPo vehicleDriverBindAppPo : driverInfoList) {
|
||||
if(ObjectUtil.equal(vehicleDriverBindAppPo.getDefaultFlag(),1)){
|
||||
//将默认状态的放在列表第一个
|
||||
driverInfoList.remove(vehicleDriverBindAppPo);
|
||||
driverInfoList.add(0,vehicleDriverBindAppPo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return driverInfoList;
|
||||
}
|
||||
|
||||
public List<DriverVehicleBindPo> getInfoListByUid(Long userId) {
|
||||
// //获取当前登录人
|
||||
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// if (ObjectUtil.isNull(loginUser)) {
|
||||
// throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
// }
|
||||
|
||||
if (ObjectUtil.isNull(userId)) {
|
||||
throw new ServiceException("查询必要参数为空!");
|
||||
}
|
||||
|
||||
DriverVehicleBindDo driverVehicleBindDo = new DriverVehicleBindDo();
|
||||
driverVehicleBindDo.setDriverBindId(userId);
|
||||
return driverVehicleBindDomainService.queryList(driverVehicleBindDo);
|
||||
}
|
||||
|
||||
public DriverVehicleBindPo getDefaultVehicleInfoListByUid(Long userId) {
|
||||
if (ObjectUtil.isNull(userId)) {
|
||||
throw new ServiceException("查询必要参数为空!");
|
||||
}
|
||||
DriverVehicleBindDo driverVehicleBindDo = new DriverVehicleBindDo();
|
||||
driverVehicleBindDo.setDriverBindId(userId);
|
||||
driverVehicleBindDo.setDefaultFlag(1);
|
||||
List<DriverVehicleBindPo> driverVehicleBindPoList = driverVehicleBindDomainService.queryList(driverVehicleBindDo);
|
||||
if (driverVehicleBindPoList.isEmpty()){
|
||||
throw new ServiceException("该司机未绑定默认车辆!");
|
||||
}
|
||||
if (driverVehicleBindPoList.size() > 1){
|
||||
throw new ServiceException("该司机有多个默认车辆,请联系管理员!");
|
||||
}
|
||||
return driverVehicleBindPoList.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车辆id变更绑定关系车主id
|
||||
* @param driverVehicleBindDo
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean changeVehicleUserId(DriverVehicleBindDo driverVehicleBindDo) {
|
||||
//先进行查询,存在再修改
|
||||
DriverVehicleBindDo driverVehicleBindDo1 = new DriverVehicleBindDo();
|
||||
driverVehicleBindDo1.setVehicleId(driverVehicleBindDo.getVehicleId());
|
||||
List<DriverVehicleBindPo> list = driverVehicleBindDomainService.queryList(driverVehicleBindDo1);
|
||||
if (list != null && list.size() > 0){
|
||||
Boolean flag = driverVehicleBindDomainService.changeVehicleUserId(driverVehicleBindDo);
|
||||
if(!flag){
|
||||
throw new ServiceException("变更失败");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, Object> getDefaultUserByVid(Long vehicleId) {
|
||||
DriverVehicleBind driverVehicleBind = driverVehicleBindDomainService.getDefaultUserByVid(vehicleId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("userId", ObjectUtil.isNotNull(driverVehicleBind) ? driverVehicleBind.getDriverBindId() : "");
|
||||
map.put("userName", ObjectUtil.isNotNull(driverVehicleBind) ? driverVehicleBind.getBindDriverName() : "");
|
||||
map.put("userPhone", ObjectUtil.isNotNull(driverVehicleBind) ? driverVehicleBind.getBindDriverPhone() : "");
|
||||
return map;
|
||||
}
|
||||
|
||||
public Boolean informationSynchronization(DriverVehicleBindDto driverVehicleBindDto) {
|
||||
if (ObjectUtil.isNull(driverVehicleBindDto.getVehicleId())) {
|
||||
throw new ServiceException("缺少必要参数");
|
||||
}
|
||||
driverVehicleBindDomainService.informationSynchronization(driverVehicleBindDto);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<Long> getBindListByUserId(Long id) {
|
||||
return driverVehicleBindDomainService.getBindListByUserId(id);
|
||||
}
|
||||
|
||||
public List<Long> getAllBindList() {
|
||||
return driverVehicleBindDomainService.getAllBindList();
|
||||
}
|
||||
|
||||
public boolean isVehicleBinding(String vehicleLicensePlateNumber) {
|
||||
DriverVehicleBind driverVehicleBind= driverVehicleBindDomainService.isVehicleBinding(vehicleLicensePlateNumber);
|
||||
boolean isTrue=false;
|
||||
if(ObjectUtil.isNotNull(driverVehicleBind)){
|
||||
isTrue=true;
|
||||
}
|
||||
return isTrue;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.repository.po.FeedbackPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.FeedbackDO;
|
||||
import com.mhd.user.domain.userAggregate.service.FeedbackDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FeedbackApplicationService {
|
||||
|
||||
@Resource
|
||||
private FeedbackDomainService feedbackDomainService;
|
||||
|
||||
public Boolean updateFeedback(FeedbackDO feedbackDO) {
|
||||
feedbackDomainService.updateFeedback(feedbackDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Boolean addFeedback(FeedbackDO feedbackDO) {
|
||||
feedbackDomainService.addFeedback(feedbackDO);
|
||||
return null;
|
||||
}
|
||||
|
||||
public FeedbackPo getFeedbackInfo(Long feedbackId) {
|
||||
FeedbackPo feedbackPo = feedbackDomainService.getFeedbackInfo(feedbackId);
|
||||
return feedbackPo;
|
||||
}
|
||||
|
||||
public List<FeedbackPo> feedbackList(FeedbackDO feedbackDO) {
|
||||
List<FeedbackPo> list = feedbackDomainService.feedbackList(feedbackDO);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+1172
File diff suppressed because it is too large
Load Diff
+309
@@ -0,0 +1,309 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.accountInfo.AccountBankCardPo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
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.OrderSequence;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.FinanceServiceFeign;
|
||||
import com.mhd.system.api.domain.TmsCollectionAgentWlhyDTO;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDomainService;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
import com.mhd.user.domain.motorcadeCollection.service.MotorcadeCollectionDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverEnterpriseDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.user.interfaces.assember.MotorcadeCollectionAssembler;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeCollectionDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 车队代收协议ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeCollectionApplicationService {
|
||||
@Autowired
|
||||
private MotorcadeCollectionDomainService motorcadeCollectionDomainService;
|
||||
@Autowired
|
||||
private AgentSignApplicationService agentSignApplicationService;
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
@Autowired
|
||||
private CommonApplicationService commonApplicationService;
|
||||
@Autowired
|
||||
private UserDriverEnterpriseDomainService userDriverEnterpriseDomainService;
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
@Autowired
|
||||
private FinanceServiceFeign financeServiceFeign;
|
||||
@Autowired
|
||||
private MotorcadeDomainService motorcadeDomainService;
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询车队代收协议列表
|
||||
*/
|
||||
|
||||
public List<MotorcadeCollectionPO> queryList(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
motorcadeCollectionDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return motorcadeCollectionDomainService.queryList(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车队代收协议
|
||||
*/
|
||||
public Boolean insert(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
|
||||
return motorcadeCollectionDomainService.insert(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队代收协议
|
||||
*/
|
||||
public Boolean update(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
return motorcadeCollectionDomainService.update(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队代收协议
|
||||
*/
|
||||
public boolean delete(Long[] motorcadeCollectionIds) {
|
||||
return motorcadeCollectionDomainService.delete(motorcadeCollectionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车队代收协议详细信息
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfo(Long motorcadeCollectionId)
|
||||
{
|
||||
return motorcadeCollectionDomainService.getInfo(motorcadeCollectionId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据车队id和用户id查询代收款协议
|
||||
* @param motorcadeId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public MotorcadeCollection selectByUserAndMotor(Long motorcadeId, Long userId) {
|
||||
return motorcadeCollectionDomainService.selectByUserAndMotor(motorcadeId,userId);
|
||||
}
|
||||
|
||||
public boolean saveOrUpdate(MotorcadeCollection motorcadeCollection) {
|
||||
return motorcadeCollectionDomainService.saveOrUpdate(motorcadeCollection);
|
||||
}
|
||||
|
||||
public MotorcadeCollection selectByFlowId(String flowId) {
|
||||
return motorcadeCollectionDomainService.selectByFlowId(flowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id和用户ID查询代收款协议
|
||||
* @param motorcadeId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfoByMoIdAndUserId(Long motorcadeId, Long userId) {
|
||||
return motorcadeCollectionDomainService.getInfoByMoIdAndUserId(motorcadeId,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 补签协议
|
||||
* @param motorcadeCollectionDTO
|
||||
* @return
|
||||
*/
|
||||
public String supplementarySignature(MotorcadeCollectionDTO motorcadeCollectionDTO) {
|
||||
if(motorcadeCollectionDTO.getMotorcadeId()==null || motorcadeCollectionDTO.getUserId()==null){
|
||||
throw new ServiceException("车队ID或者司机ID不能为空");
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//获取E签宝连接
|
||||
String signUrl = "";
|
||||
MotorcadeCollectionPO motorcadeCollectionPO;
|
||||
//车队长/运输企业用户ID
|
||||
Long headerId;
|
||||
//司机ID
|
||||
Long driverUserId;
|
||||
if(motorcadeCollectionDTO.getContractType()==1){
|
||||
headerId = loginUser.getUserPo().getUserId();
|
||||
driverUserId = motorcadeCollectionDTO.getUserId();
|
||||
motorcadeCollectionPO = motorcadeCollectionDomainService.getInfoByUserIds(loginUser.getUserPo().getUserId(), motorcadeCollectionDTO.getUserId());
|
||||
}else{
|
||||
headerId = motorcadeCollectionDTO.getUserId();
|
||||
driverUserId = loginUser.getUserPo().getUserId();
|
||||
//司机签车队长
|
||||
motorcadeCollectionPO = motorcadeCollectionDomainService.getInfoByUserIds(motorcadeCollectionDTO.getUserId(), loginUser.getUserPo().getUserId());
|
||||
}
|
||||
if(null == motorcadeCollectionPO){
|
||||
//没有代收款协议,所以重新拉取E签宝生成并下发
|
||||
//获取租户的开关配置信息
|
||||
UserConfigSwitchPo userConfigSwitchPo = commonApplicationService.getUserConfigSwitch();
|
||||
if(null == userConfigSwitchPo){
|
||||
throw new ServiceException("平台租户开关配置未找到");
|
||||
}
|
||||
//查询车队长/运输企业签署用户信息
|
||||
UserPo loginUserPo = userDomainService.selectByUserId(headerId);
|
||||
if(null == loginUserPo){
|
||||
throw new ServiceException("签署用户信息未找到");
|
||||
}
|
||||
MotorcadeCollectionDO motorcadeCollectionDO = new MotorcadeCollectionAssembler().getDoEntity();
|
||||
motorcadeCollectionDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
motorcadeCollectionDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
motorcadeCollectionDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
//根据用户角色查询不同信息,如果同时拥有车队和运输企业,则以运输企业形势签署
|
||||
if(loginUserPo.getRoleCode().contains(RoleEnum.CARRIER.getCode())){
|
||||
UserDriverEnterprisePo userDriverEnterprisePo = userDriverEnterpriseDomainService.getInfoByUserId(loginUser.getUserPo().getUserId());
|
||||
motorcadeCollectionDO.setMotorcadeId(userDriverEnterprisePo.getUserDriverEnterpriseId());
|
||||
motorcadeCollectionDO.setMotorcadeName(userDriverEnterprisePo.getDriverEnterpriseName());
|
||||
}else {
|
||||
MotorcadePo motorcadePo = motorcadeDomainService.getInfo(motorcadeCollectionDTO.getMotorcadeId());
|
||||
if(null != motorcadePo){
|
||||
motorcadeCollectionDO.setMotorcadeId(motorcadePo.getMotorcadeId());
|
||||
motorcadeCollectionDO.setMotorcadeName(motorcadePo.getMotorcadeName());
|
||||
}
|
||||
}
|
||||
motorcadeCollectionDO.setMotorcadeHeaderId(headerId);
|
||||
motorcadeCollectionDO.setUserId(driverUserId);
|
||||
motorcadeCollectionDO.setContractNo(OrderSequence.getOrderCode("HT"));
|
||||
|
||||
//保存协议数据
|
||||
MotorcadeCollection newEntity = null;
|
||||
//生成代收款协议
|
||||
if(userConfigSwitchPo.getMotorcadeCollectionSwitch()==1){
|
||||
TmsCollectionAgentWlhyDTO tmsCollectionAgentWlhyDTO = new TmsCollectionAgentWlhyDTO();
|
||||
//甲方:平台信息,查询组织信息
|
||||
AjaxResult organizationInfo = productServiceFeign.getInfo(loginUser.getUserPo().getOrganizationId());
|
||||
String code = organizationInfo.get("code").toString();
|
||||
if (!"200".equals(code)) {
|
||||
throw new com.mhd.common.core.exception.ServiceException("组织信息未找到!");
|
||||
}
|
||||
OrganizationPo organizationPo = BeanUtil.toBean(organizationInfo.get("data"), OrganizationPo.class);
|
||||
if(null != organizationPo){
|
||||
tmsCollectionAgentWlhyDTO.setPhoneA(organizationPo.getServiceHotline());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumA(organizationPo.getLegalPersonIdNo());
|
||||
tmsCollectionAgentWlhyDTO.setPartyA(organizationPo.getOrganizationName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsA(organizationPo.getLegalPerson());
|
||||
if(organizationPo.getOrganizationState() != null && organizationPo.getOrganizationState() == 2 && !StringUtils.isNotBlank(organizationPo.getElectricSignature())){
|
||||
throw new com.mhd.common.core.exception.ServiceException("当前组织未配置签章信息");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setEsignSealId(organizationPo.getElectricSignature());
|
||||
}
|
||||
//乙方:司机信息
|
||||
UserPo userPo = userDomainService.selectByUserId(motorcadeCollectionDO.getUserId());
|
||||
if(null == userPo) {
|
||||
throw new com.mhd.common.core.exception.ServiceException("司机信息未找到");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setPhoneB(userPo.getUserPhone());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumB(userPo.getUserIdcardNumber());
|
||||
tmsCollectionAgentWlhyDTO.setPartyB(userPo.getUserName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsB(userPo.getUserName());
|
||||
//丙方:车队长信息
|
||||
UserPo userPoCap = userDomainService.selectByUserId(motorcadeCollectionDO.getMotorcadeHeaderId());
|
||||
if(null == userPoCap) {
|
||||
throw new com.mhd.common.core.exception.ServiceException("车队长信息未找到");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setPhoneC(userPoCap.getUserPhone());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumC(userPoCap.getUserIdcardNumber());
|
||||
tmsCollectionAgentWlhyDTO.setPartyC(userPoCap.getUserName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsC(userPoCap.getUserName());
|
||||
//查询车队长银行卡账户信息
|
||||
AjaxResult accountBankCardByUser = financeServiceFeign.getAccountBankCardByUser(motorcadeCollectionDO.getMotorcadeHeaderId());
|
||||
if("200".equals(String.valueOf(accountBankCardByUser.get("code")))){
|
||||
List<AccountBankCardPo> accountBankCardPoList = JSON.parseArray(JSONObject.toJSONString(accountBankCardByUser.get("data")), AccountBankCardPo.class);
|
||||
if(accountBankCardPoList != null && accountBankCardPoList.size()>0){
|
||||
AccountBankCardPo accountBankCardPo = accountBankCardPoList.stream().filter(item -> item.getDefaultStatus()==1)
|
||||
.findFirst().orElse(accountBankCardPoList.get(0));
|
||||
tmsCollectionAgentWlhyDTO.setAccountNo(accountBankCardPo.getBankBindingName());
|
||||
tmsCollectionAgentWlhyDTO.setBankName(accountBankCardPo.getBankName());
|
||||
tmsCollectionAgentWlhyDTO.setBankCard(accountBankCardPo.getBankCardNumber());
|
||||
}
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setSigningDate(new Date());
|
||||
tmsCollectionAgentWlhyDTO.setContractNo(motorcadeCollectionDO.getContractNo());
|
||||
|
||||
//保存协议数据
|
||||
newEntity = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,newEntity);
|
||||
this.saveOrUpdate(newEntity);
|
||||
signUrl = agentSignApplicationService.signAgreement(loginUser, tmsCollectionAgentWlhyDTO, newEntity);
|
||||
}
|
||||
if (newEntity == null){
|
||||
newEntity = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,newEntity);
|
||||
newEntity.setAgreementUrl(signUrl);
|
||||
this.saveOrUpdate(newEntity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(motorcadeCollectionDTO.getContractType()==1){
|
||||
//车队签司机:传车队的手机号
|
||||
//查询车队长用户手机号
|
||||
UserPo userPo = userDomainService.selectByUserId(motorcadeCollectionPO.getMotorcadeHeaderId());
|
||||
signUrl = agentSignApplicationService.getSignContractUrl(motorcadeCollectionPO.getFlowId(),userPo.getUserPhone());
|
||||
}else {
|
||||
//司机签车队长,传司机手机号
|
||||
UserPo userPo = userDomainService.selectByUserId(motorcadeCollectionPO.getUserId());
|
||||
signUrl = agentSignApplicationService.getSignContractUrl(motorcadeCollectionPO.getFlowId(),userPo.getUserPhone());
|
||||
}
|
||||
}
|
||||
return signUrl;
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public void dowmloadPdf(String flowId) {
|
||||
MotorcadeCollection motorcadeCollection = motorcadeCollectionDomainService.selectByFlowId(flowId);
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("signFlowId", flowId);
|
||||
param.put("type", "2");
|
||||
R<String> resultR = thirdPartyServiceFeign.downloadSignContract(param);
|
||||
if (ObjectUtil.isNotNull(resultR) && R.SUCCESS == resultR.getCode()){
|
||||
motorcadeCollection.setAgreementUrlPdf(resultR.getData());
|
||||
motorcadeCollectionDomainService.saveOrUpdate(motorcadeCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
+851
@@ -0,0 +1,851 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.core.constant.NoticeConstants;
|
||||
import com.mhd.common.core.domain.dto.NoticeMessageLoggingDto;
|
||||
import com.mhd.common.core.domain.dto.SyncTmsVehicleDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.common.core.domain.po.accountInfo.AccountBankCardPo;
|
||||
import com.mhd.common.core.enums.MessageTypeEnum;
|
||||
import com.mhd.common.core.service.jPush.AsyncJPushApplicationService;
|
||||
import com.mhd.common.core.utils.DateUtils;
|
||||
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.system.api.FinanceServiceFeign;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import com.mhd.system.api.domain.TmsCollectionAgentWlhyDTO;
|
||||
import com.mhd.system.api.domain.TmsDriverAddOrUpdateDTO;
|
||||
import com.mhd.system.api.domain.finance.AccountCashWalletPo;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDomainService;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDriverDomainService;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeRecordDomainService;
|
||||
import com.mhd.system.api.TransportFeign;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserWlhyDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.user.infrastructure.feign.SystemServiceFeign;
|
||||
import com.mhd.user.interfaces.assember.MotorcadeCollectionAssembler;
|
||||
import com.mhd.user.interfaces.assember.MotorcadeDriverAssembler;
|
||||
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.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.interfaces.assember.MotorcadeRecordAssembler;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeCollectionDTO;
|
||||
import com.mhd.user.interfaces.dto.MotorcadeRecordDto;
|
||||
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 javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 车队邀请记录ApplicationService
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeRecordApplicationService {
|
||||
@Autowired
|
||||
private MotorcadeRecordDomainService motorcadeRecordDomainService;
|
||||
@Autowired
|
||||
private MotorcadeDriverDomainService motorcadeDriverDomainService;
|
||||
@Resource
|
||||
private UserApplicationService userApplicationService;
|
||||
@Resource
|
||||
private DriverVehicleBindApplicationService driverVehicleBindApplicationService;
|
||||
@Autowired
|
||||
private MotorcadeDomainService motorcadeDomainService;
|
||||
@Resource
|
||||
private TransportFeign transportFeign;
|
||||
@Resource
|
||||
private UserWlhyDomainService wlhyDomainService;
|
||||
|
||||
@Resource
|
||||
private UserDriverDomainService userDriverDomainService;
|
||||
|
||||
@Autowired
|
||||
private CommonApplicationService commonApplicationService;
|
||||
|
||||
@Autowired
|
||||
private OpenTmsUserApplicationService openTmsUserApplicationService;
|
||||
@Autowired
|
||||
private MotorcadeCollectionApplicationService motorcadeCollectionApplicationService;
|
||||
@Autowired
|
||||
private WlhyServiceFeign wlhyServiceFeign;
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
@Autowired
|
||||
private FinanceServiceFeign financeServiceFeign;
|
||||
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private AsyncJPushApplicationService asyncJPushApplicationService;
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
@Autowired
|
||||
private AgentSignApplicationService agentSignApplicationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车队邀请记录列表
|
||||
*/
|
||||
|
||||
public List<MotorcadeRecordPo> queryList(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
List<MotorcadeRecordPo> motorcadeRecordPos = motorcadeRecordDomainService.queryList(motorcadeRecordDo);
|
||||
if(motorcadeRecordPos != null && motorcadeRecordPos.size() > 0){
|
||||
for (MotorcadeRecordPo motorcadeRecordPo : motorcadeRecordPos) {
|
||||
// List<Map<String,String>> maps = driverVehicleBindApplicationService.selectVehicleIdList(motorcadeRecordPo.getDriverId());
|
||||
// motorcadeRecordPo.setVehicleMapList(maps);
|
||||
// if(longs != null && longs.size() > 0){
|
||||
// VehicleDto vehicleDto = new VehicleDto();
|
||||
// vehicleDto.setVehicleIdList(longs);
|
||||
// TableDataInfo tableDataInfo = transportFeign.listTwo(vehicleDto);
|
||||
// if(200 == tableDataInfo.getCode()){
|
||||
// List<VehiclePo> data = tableDataInfo.getData();
|
||||
// motorcadeRecordPo.setVehicleList(data);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
return motorcadeRecordDomainService.queryList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表(是否新邀请)
|
||||
*/
|
||||
public List<MotorcadeRecordPo> selectRecordList(Integer isNew){
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
motorcadeRecordDo.setIsNew(isNew);
|
||||
return motorcadeRecordDomainService.selectRecordList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车队邀请记录
|
||||
*/
|
||||
public Boolean insert(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
MotorcadePo info = motorcadeDomainService.getInfo(motorcadeRecordDo.getMotorcadeId());
|
||||
if(info != null ){
|
||||
motorcadeRecordDo.setMotorcadeDescribtion(info.getMotorcadeDescribtion());
|
||||
motorcadeRecordDo.setMotorcadeImage(info.getMotorcadeImage());
|
||||
motorcadeRecordDo.setMotorcadeHeaderName(info.getMotorcadeHeaderName());
|
||||
motorcadeRecordDo.setMotorcadeName(info.getMotorcadeName());
|
||||
motorcadeRecordDo.setMotorcadeScore(info.getMotorcadeScore());
|
||||
}
|
||||
motorcadeRecordDo.setRecordTime(new Date());
|
||||
return motorcadeRecordDomainService.insert(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队邀请记录
|
||||
*/
|
||||
public Boolean update(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordDomainService.update(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收/拒绝(加入车队)
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String updateStatus(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
String signUrl = "";
|
||||
if(motorcadeRecordDo.getMotorcadeRecordId() == null){
|
||||
throw new ServiceException("邀请记录id不能为空");
|
||||
}
|
||||
MotorcadeRecordPo motorcadeRecordPo = motorcadeRecordDomainService.getInfo(motorcadeRecordDo.getMotorcadeRecordId());
|
||||
if(null == motorcadeRecordPo){
|
||||
throw new ServiceException("邀请记录不存在或已被删除");
|
||||
}
|
||||
if(motorcadeRecordPo.getMotorcadeRecordStatus() != 0){
|
||||
throw new ServiceException("申请已被处理,请勿重复操作");
|
||||
}
|
||||
if(motorcadeRecordDo.getMotorcadeRecordStatus() == null || (motorcadeRecordDo.getMotorcadeRecordStatus()!=1 && motorcadeRecordDo.getMotorcadeRecordStatus()!=2)){
|
||||
throw new ServiceException("状态类型错误");
|
||||
}
|
||||
UserPo userPo = userApplicationService.selectByUserId(motorcadeRecordPo.getUserId());
|
||||
if(userPo == null){
|
||||
throw new ServiceException("司机信息不存在");
|
||||
}
|
||||
//获取租户的开关配置信息
|
||||
UserConfigSwitchPo userConfigSwitchPo = commonApplicationService.getUserConfigSwitch();
|
||||
if(null == userConfigSwitchPo){
|
||||
throw new ServiceException("平台租户开关配置未找到");
|
||||
}
|
||||
MotorcadePo motorcadePo = motorcadeDomainService.getInfo(motorcadeRecordPo.getMotorcadeId());
|
||||
if (motorcadePo == null){
|
||||
throw new ServiceException("车队信息不存在");
|
||||
}
|
||||
MotorcadeRecordDO motorcadeRecordDOSave = new MotorcadeRecordDO();
|
||||
BeanUtils.copyProperties(motorcadeRecordPo,motorcadeRecordDOSave);
|
||||
Boolean flag = motorcadeRecordDomainService.update(motorcadeRecordDo);
|
||||
Boolean flagTwo = true;
|
||||
if(motorcadeRecordDo.getMotorcadeRecordStatus() == 1){
|
||||
//同意加入车队,则插入关联关系
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriverAssembler().getEntity();
|
||||
motorcadeDriver.setMotorcadeId(motorcadeRecordPo.getMotorcadeId());
|
||||
motorcadeDriver.setUserId(motorcadeRecordPo.getUserId());
|
||||
flagTwo = motorcadeDriverDomainService.insert(motorcadeDriver);
|
||||
|
||||
//2024年3月20日 新增需求 增加代收款协议的签署 如果司机同意加入车队,则司机与该车队建立代收款协议签订
|
||||
//2024年8月16日 使用E签宝V3版本的,控制在邀请时生成代收款协议,在同意时司机签署代收款协议
|
||||
// signAgreement(motorcadeRecordPo);
|
||||
|
||||
//查询该司机下所有车辆信息 同步tms
|
||||
R<List<VehiclePo>> vehicleR = transportFeign.getVehiclePosByUserId(motorcadeRecordPo.getUserId());
|
||||
if (R.FAIL == vehicleR.getCode() || CollectionUtil.isEmpty(vehicleR.getData())){
|
||||
throw new ServiceException("请先认证车辆后再接单");
|
||||
}
|
||||
SyncTmsVehicleDTO syncTmsVehicleDTO = new SyncTmsVehicleDTO();
|
||||
syncTmsVehicleDTO.setDriverEnterpriseCode(motorcadePo.getDriverEnterpriseCode());
|
||||
syncTmsVehicleDTO.setVehicleList(vehicleR.getData());
|
||||
AjaxResult<?> ajaxResult = transportFeign.syncTmsVehicle(syncTmsVehicleDTO);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("同步司机车辆信息失败:" + ajaxResult.get("msg"));
|
||||
}
|
||||
//加入车队的司机 给tms同步归属关系
|
||||
UserPo userPoTms = new UserPo();
|
||||
BeanUtils.copyProperties(userPo, userPoTms);
|
||||
userPoTms.setDriverEnterpriseCode(motorcadePo.getDriverEnterpriseCode());
|
||||
//openTmsUserApplicationService.userDriverAuth(userPoTms);
|
||||
|
||||
//同意加入车队,继续签署签章,根据司机,和车队信息,查询签署信息,拿到流程id
|
||||
if(userConfigSwitchPo.getMotorcadeCollectionSwitch()==1){
|
||||
MotorcadeCollectionPO motorcadeCollectionPO = motorcadeCollectionApplicationService.getInfoByMoIdAndUserId(motorcadeRecordPo.getMotorcadeId(), userPo.getUserId());
|
||||
if (null != motorcadeCollectionPO) {
|
||||
signUrl = agentSignApplicationService.getSignContractUrl(motorcadeCollectionPO.getFlowId(),userPo.getUserPhone());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!flag || !flagTwo){
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
if(motorcadeRecordDo.getMotorcadeRecordStatus() == 1){
|
||||
//同步车队司机
|
||||
addMotorcadeMember(motorcadeRecordPo);
|
||||
}
|
||||
return signUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车队与司机签署代收款协议
|
||||
* @param motorcadeRecordPo
|
||||
*/
|
||||
private String signAgreement(MotorcadeRecordPo motorcadeRecordPo) {
|
||||
String signAgreement = "";
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//获取租户的开关配置信息
|
||||
UserConfigSwitchPo userConfigSwitchPo = commonApplicationService.getUserConfigSwitch();
|
||||
if(null == userConfigSwitchPo){
|
||||
throw new ServiceException("平台租户开关配置未找到");
|
||||
}
|
||||
//查询车辆信息
|
||||
MotorcadePo motorcadePo = motorcadeDomainService.getInfo(motorcadeRecordPo.getMotorcadeId());
|
||||
if(null == motorcadePo){
|
||||
throw new ServiceException("车队信息未找到");
|
||||
}
|
||||
//查询是否已生成代收款协议
|
||||
MotorcadeCollection motorcadeCollection = motorcadeCollectionApplicationService.selectByUserAndMotor(motorcadePo.getMotorcadeId(),motorcadeRecordPo.getUserId());
|
||||
MotorcadeCollectionDO motorcadeCollectionDO = new MotorcadeCollectionAssembler().getDoEntity();
|
||||
if(null != motorcadeCollection){
|
||||
motorcadeCollectionDO.setMotorcadeCollectionId(motorcadeCollection.getMotorcadeCollectionId());
|
||||
}
|
||||
motorcadeCollectionDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
motorcadeCollectionDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
motorcadeCollectionDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
motorcadeCollectionDO.setMotorcadeId(motorcadePo.getMotorcadeId());
|
||||
motorcadeCollectionDO.setMotorcadeName(motorcadePo.getMotorcadeName());
|
||||
motorcadeCollectionDO.setMotorcadeHeaderId(motorcadePo.getMotorcadeHeaderId());
|
||||
motorcadeCollectionDO.setUserId(motorcadeRecordPo.getUserId());
|
||||
motorcadeCollectionDO.setContractNo(OrderSequence.getOrderCode("HT"));
|
||||
|
||||
//保存协议数据
|
||||
MotorcadeCollection newEntity = null;
|
||||
//生成代收款协议
|
||||
if(userConfigSwitchPo.getMotorcadeCollectionSwitch()==1){
|
||||
TmsCollectionAgentWlhyDTO tmsCollectionAgentWlhyDTO = new TmsCollectionAgentWlhyDTO();
|
||||
//甲方:平台信息,查询组织信息
|
||||
AjaxResult organizationInfo = productServiceFeign.getInfo(loginUser.getUserPo().getOrganizationId());
|
||||
String code = organizationInfo.get("code").toString();
|
||||
if (!"200".equals(code)) {
|
||||
throw new ServiceException("组织信息未找到!");
|
||||
}
|
||||
OrganizationPo organizationPo = BeanUtil.toBean(organizationInfo.get("data"), OrganizationPo.class);
|
||||
if(null != organizationPo){
|
||||
tmsCollectionAgentWlhyDTO.setPhoneA(organizationPo.getServiceHotline());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumA(organizationPo.getLegalPersonIdNo());
|
||||
tmsCollectionAgentWlhyDTO.setPartyA(organizationPo.getOrganizationName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsA(organizationPo.getLegalPerson());
|
||||
if(organizationPo.getOrganizationState() != null && organizationPo.getOrganizationState() == 2 && !StringUtils.isNotBlank(organizationPo.getElectricSignature())){
|
||||
throw new ServiceException("当前组织未配置签章信息");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setEsignSealId(organizationPo.getElectricSignature());
|
||||
/*tmsCollectionAgentWlhyDTO.setAccountIdA(organizationPo.getAccountId());
|
||||
tmsCollectionAgentWlhyDTO.setTemplateA(organizationPo.getTemplateSeal());*/
|
||||
}
|
||||
//乙方:司机信息
|
||||
UserPo userPo = userApplicationService.selectByUserId(motorcadeRecordPo.getUserId());
|
||||
if(null == userPo) {
|
||||
throw new ServiceException("司机信息未找到");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setPhoneB(userPo.getUserPhone());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumB(userPo.getUserIdcardNumber());
|
||||
tmsCollectionAgentWlhyDTO.setPartyB(userPo.getUserName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsB(userPo.getUserName());
|
||||
/*if(!StringUtils.isNotBlank(userPo.getAccountId())){
|
||||
throw new ServiceException("司机未开通E签宝账户");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setTemplateB(userPo.getUserTemplateSeal());
|
||||
tmsCollectionAgentWlhyDTO.setAccountIdB(userPo.getAccountId());*/
|
||||
//丙方:车队长信息
|
||||
UserPo userPoCap = userApplicationService.selectByUserId(motorcadePo.getMotorcadeHeaderId());
|
||||
if(null == userPoCap) {
|
||||
throw new ServiceException("车队长信息未找到");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setPhoneC(userPoCap.getUserPhone());
|
||||
tmsCollectionAgentWlhyDTO.setIdNumC(userPoCap.getUserIdcardNumber());
|
||||
tmsCollectionAgentWlhyDTO.setPartyC(userPoCap.getUserName());
|
||||
tmsCollectionAgentWlhyDTO.setContactsC(userPoCap.getUserName());
|
||||
/*if(!StringUtils.isNotBlank(userPoCap.getAccountId())){
|
||||
throw new ServiceException("车队未开通E签宝账户");
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setTemplateC(userPoCap.getUserTemplateSeal());
|
||||
tmsCollectionAgentWlhyDTO.setAccountIdC(userPoCap.getAccountId());*/
|
||||
//查询车队长银行卡账户信息
|
||||
AjaxResult accountBankCardByUser = financeServiceFeign.getAccountBankCardByUser(motorcadePo.getMotorcadeHeaderId());
|
||||
if("200".equals(String.valueOf(accountBankCardByUser.get("code")))){
|
||||
List<AccountBankCardPo> accountBankCardPoList = JSON.parseArray(JSONObject.toJSONString(accountBankCardByUser.get("data")), AccountBankCardPo.class);
|
||||
if(accountBankCardPoList != null && accountBankCardPoList.size()>0){
|
||||
AccountBankCardPo accountBankCardPo = accountBankCardPoList.stream().filter(item -> item.getDefaultStatus()==1)
|
||||
.findFirst().orElse(accountBankCardPoList.get(0));
|
||||
tmsCollectionAgentWlhyDTO.setAccountNo(accountBankCardPo.getBankBindingName());
|
||||
tmsCollectionAgentWlhyDTO.setBankName(accountBankCardPo.getBankName());
|
||||
tmsCollectionAgentWlhyDTO.setBankCard(accountBankCardPo.getBankCardNumber());
|
||||
}
|
||||
}
|
||||
tmsCollectionAgentWlhyDTO.setSigningDate(new Date());
|
||||
tmsCollectionAgentWlhyDTO.setContractNo(motorcadeCollectionDO.getContractNo());
|
||||
|
||||
//保存协议数据
|
||||
newEntity = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,newEntity);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(newEntity);
|
||||
signAgreement = agentSignApplicationService.signAgreement(loginUser, tmsCollectionAgentWlhyDTO, newEntity);
|
||||
/*R<String> resultR = wlhyServiceFeign.signAgreement(tmsCollectionAgentWlhyDTO);
|
||||
if (R.SUCCESS != resultR.getCode()) {
|
||||
throw new ServiceException(resultR.getMsg());
|
||||
}
|
||||
motorcadeCollectionDO.setAgreementUrl(resultR.getData());*/
|
||||
}
|
||||
if (newEntity == null){
|
||||
newEntity = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,newEntity);
|
||||
newEntity.setAgreementUrl(signAgreement);
|
||||
motorcadeCollectionApplicationService.saveOrUpdate(newEntity);
|
||||
}
|
||||
return signAgreement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 同步车队司机信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/12/25 14:58
|
||||
* @param motorcadeRecordPo
|
||||
*/
|
||||
private String addMotorcadeMember(MotorcadeRecordPo motorcadeRecordPo){
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
userDriverDO.setMotorcadeId(motorcadeRecordPo.getMotorcadeId());
|
||||
userDriverDO.setUserId(motorcadeRecordPo.getUserId());
|
||||
return wlhyDomainService.addMotorcadeMember(userDriverDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 同步车队司机信息
|
||||
* @author ZhouGY
|
||||
* @date 2023/12/25 14:58
|
||||
* @param motorcadeId
|
||||
* @param userid
|
||||
*/
|
||||
private void delMotorcadeMember(Long motorcadeId, Long userid){
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
userDriverDO.setMotorcadeId(motorcadeId);
|
||||
userDriverDO.setUserId(userid);
|
||||
wlhyDomainService.delMotorcadeMember(userDriverDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理司机加入车队逻辑
|
||||
* @param motorcadeId 车队ID
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleDriverFleetBinding(Long motorcadeId, Long userId) {
|
||||
// 如果车队Id为空,不执行加入车队相关逻辑
|
||||
if (ObjectUtil.isNull(motorcadeId)){
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询当前用户选择的车队信息
|
||||
MotorcadePo motorcade = motorcadeDomainService.getInfo(motorcadeId);
|
||||
if (motorcade == null){
|
||||
throw new ServiceException("车队不存在,请联系平台管理员处理!");
|
||||
}
|
||||
|
||||
// 查询司机当前的车队绑定关系
|
||||
List<MotorcadeDriver> currentMotorcadeDrivers = motorcadeDriverDomainService.getListByDriveId(userId);
|
||||
MotorcadeDriver existingBinding = null;
|
||||
if (currentMotorcadeDrivers != null && !currentMotorcadeDrivers.isEmpty()) {
|
||||
for (MotorcadeDriver driver : currentMotorcadeDrivers) {
|
||||
if (driver.getDelFlag() == 1) {
|
||||
existingBinding = driver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果司机已经绑定了相同的车队,直接返回
|
||||
if (existingBinding != null && existingBinding.getMotorcadeId().equals(motorcadeId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果司机已经绑定了其他车队,先逻辑删除旧绑定关系
|
||||
if (existingBinding != null) {
|
||||
MotorcadeDriver updateDriver = new MotorcadeDriver();
|
||||
updateDriver.setUserId(existingBinding.getUserId());
|
||||
updateDriver.setMotorcadeId(existingBinding.getMotorcadeId());
|
||||
updateDriver.setDelFlag(2);
|
||||
updateDriver.setUpdateTime(new Date());
|
||||
motorcadeDriverDomainService.updateById(updateDriver);
|
||||
|
||||
// 同步删除TMS中的旧车队成员关系
|
||||
delMotorcadeMember(existingBinding.getMotorcadeId(), userId);
|
||||
}
|
||||
|
||||
// 创建新的车队司机绑定关系
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriver();
|
||||
motorcadeDriver.setMotorcadeId(motorcadeId);
|
||||
motorcadeDriver.setUserId(userId);
|
||||
motorcadeDriver.setCreateTime(new Date());
|
||||
motorcadeDriver.setUpdateTime(new Date());
|
||||
motorcadeDriver.setDelFlag(1);
|
||||
motorcadeDriverDomainService.insert(motorcadeDriver);
|
||||
|
||||
// 同步司机信息到TMS
|
||||
UserPo userPo = userApplicationService.selectByUserId(userId);
|
||||
if (userPo != null) {
|
||||
userPo.setDriverEnterpriseCode(motorcade.getDriverEnterpriseCode());
|
||||
// openTmsUserApplicationService.userDriverAuth(userPo);
|
||||
|
||||
// 同步司机的车辆信息到TMS
|
||||
R<List<VehiclePo>> vehicleR = transportFeign.getVehiclePosByUserId(userId);
|
||||
if (R.SUCCESS == vehicleR.getCode() && vehicleR.getData() != null && !vehicleR.getData().isEmpty()) {
|
||||
SyncTmsVehicleDTO syncTmsVehicleDTO = new SyncTmsVehicleDTO();
|
||||
syncTmsVehicleDTO.setDriverEnterpriseCode(motorcade.getDriverEnterpriseCode());
|
||||
syncTmsVehicleDTO.setVehicleList(vehicleR.getData());
|
||||
syncTmsVehicleDTO.setMotorcadeId(motorcadeId);
|
||||
syncTmsVehicleDTO.setMotorcadeName(motorcade.getMotorcadeName());
|
||||
AjaxResult<?> ajaxResult = transportFeign.syncTmsVehicle(syncTmsVehicleDTO);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
log.error("同步司机车辆信息失败:{}", ajaxResult.get("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
// 同步车队司机信息
|
||||
MotorcadeRecordPo motorcadeRecordPo = new MotorcadeRecordPo();
|
||||
motorcadeRecordPo.setMotorcadeId(motorcadeId);
|
||||
motorcadeRecordPo.setUserId(userId);
|
||||
addMotorcadeMember(motorcadeRecordPo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队邀请记录
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeRecordIds) {
|
||||
return motorcadeRecordDomainService.delete(motorcadeRecordIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车队邀请记录详细信息
|
||||
*/
|
||||
public MotorcadeRecordPo getInfo(Long motorcadeRecordId)
|
||||
{
|
||||
return motorcadeRecordDomainService.getInfo(motorcadeRecordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车队邀请司机列表查询近三天
|
||||
*/
|
||||
public List<MotorcadeRecordPo> threeDayList() {
|
||||
/*
|
||||
根据当前登录用户,查询当前用户近三天来的邀请记录
|
||||
*/
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//查询现在时间往后推迟三天
|
||||
Date now = new Date();
|
||||
Date lastDay = DateUtil.offsetDay(now,-3);
|
||||
motorcadeRecordDo.setCreateStartTime(lastDay);
|
||||
motorcadeRecordDo.setUserId(loginUser.getUserid());
|
||||
return motorcadeRecordDomainService.queryList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车队邀请司机列表查询三天前
|
||||
*/
|
||||
public List<MotorcadeRecordPo> beforeThreeDayList() {
|
||||
/*
|
||||
根据当前登录用户,查询当前用户三天前邀请记录
|
||||
*/
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//查询现在时间往后推迟三天
|
||||
Date now = new Date();
|
||||
Date lastDay = DateUtil.offsetDay(now,-3);
|
||||
motorcadeRecordDo.setCreateEndTime(lastDay);
|
||||
motorcadeRecordDo.setUserId(loginUser.getUserid());
|
||||
return motorcadeRecordDomainService.queryList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请车队司机
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insertMotorcadeDriver(MotorcadeRecordDO motorcadeRecordDO) {
|
||||
String signAgreement = "";
|
||||
if(null == motorcadeRecordDO.getUserId()){
|
||||
throw new ServiceException("选中司机用户id不能为空");
|
||||
}
|
||||
if(null == motorcadeRecordDO.getMotorcadeId()){
|
||||
throw new ServiceException("车队id不能为空");
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = userDomainService.selectByUserId(loginUser.getUserPo().getUserId());
|
||||
if (userPo == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
//查询车队已经发送邀请的司机记录,不在重复发送
|
||||
LambdaQueryWrapper<MotorcadeRecord> query = new LambdaQueryWrapper<>();
|
||||
query.eq(MotorcadeRecord::getDelFlag,1);
|
||||
query.eq(MotorcadeRecord::getMotorcadeId,motorcadeRecordDO.getMotorcadeId());
|
||||
query.eq(MotorcadeRecord::getUserId,motorcadeRecordDO.getUserId());
|
||||
query.in(MotorcadeRecord::getMotorcadeRecordStatus,0,1);
|
||||
List<MotorcadeRecord> motorcadeRecordList = motorcadeRecordDomainService.selectByLambda(query);
|
||||
if(motorcadeRecordList!=null && motorcadeRecordList.size()>0){
|
||||
throw new ServiceException("请勿重复发送邀请");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<Motorcade> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Motorcade::getDelFlag,1);
|
||||
queryWrapper.eq(Motorcade::getMotorcadeId,motorcadeRecordDO.getMotorcadeId());
|
||||
queryWrapper.eq(Motorcade::getMotorcadeDissolutionStatus,1L);
|
||||
Motorcade motorcade = motorcadeDomainService.selectOneByLambda(queryWrapper);
|
||||
if(motorcade == null){
|
||||
throw new ServiceException("车队信息未找到");
|
||||
}
|
||||
motorcadeRecordDO.setMotorcadeId(motorcadeRecordDO.getMotorcadeId());
|
||||
motorcadeRecordDO.setUserId(motorcadeRecordDO.getUserId());
|
||||
motorcadeRecordDO.setMotorcadeName(motorcade.getMotorcadeName());
|
||||
motorcadeRecordDO.setMotorcadeImage(motorcade.getMotorcadeImage());
|
||||
motorcadeRecordDO.setMotorcadeDescribtion(motorcade.getMotorcadeDescribtion());
|
||||
motorcadeRecordDO.setMotorcadeHeaderName(motorcade.getMotorcadeHeaderName());
|
||||
motorcadeRecordDO.setMotorcadeScore(motorcade.getMotorcadeScore());
|
||||
MotorcadeRecord save = motorcadeRecordDomainService.save(motorcadeRecordDO);
|
||||
if (1 == configSwitch.getIsInviteTeamAuth()) {
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
motorcadeRecordDo.setMotorcadeRecordId(save.getMotorcadeRecordId());
|
||||
motorcadeRecordDo.setMotorcadeRecordStatus(1L);
|
||||
updateStatus(motorcadeRecordDo);
|
||||
}
|
||||
MotorcadeRecordPo motorcadeRecordPo = motorcadeRecordDomainService.getInfo(motorcadeRecordDO.getMotorcadeRecordId());
|
||||
if(null != motorcadeRecordPo){
|
||||
signAgreement = signAgreement(motorcadeRecordPo);
|
||||
}
|
||||
//新增消息(推送)
|
||||
NoticeMessageLoggingDto noticeMessageLoggingDto = new NoticeMessageLoggingDto();
|
||||
noticeMessageLoggingDto.setUserId(motorcadeRecordDO.getUserId());
|
||||
noticeMessageLoggingDto.setNoticeMessageTitle(NoticeConstants.motorcade_invite_title);
|
||||
noticeMessageLoggingDto.setJumpPage(11);
|
||||
noticeMessageLoggingDto.setBusinessId(save.getMotorcadeRecordId().toString());
|
||||
String text = StringUtils.format(NoticeConstants.motorcade_invite,userPo.getUserName(), motorcade.getMotorcadeName());
|
||||
|
||||
noticeMessageLoggingDto.setNoticeMessageContent(text);
|
||||
noticeMessageLoggingDto.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
noticeMessageLoggingDto.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
noticeMessageLoggingDto.setCreateTime(new Date());
|
||||
noticeMessageLoggingDto.setMessagePushTime(new Date());
|
||||
noticeMessageLoggingDto.setNoticeMessageType(MessageTypeEnum.system_notifications.getCode());
|
||||
noticeMessageLoggingDto.setNoticeMessageName(MessageTypeEnum.system_notifications.getInfo());
|
||||
systemServiceFeign.addMessageLogging(noticeMessageLoggingDto);
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlia(NoticeConstants.audit_title, text, motorcadeRecordDO.getUserId().toString(), 0);
|
||||
|
||||
|
||||
return signAgreement;
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请车队司机
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertMotorcadeDriverPC(MotorcadeRecordDO motorcadeRecordDO) {
|
||||
String userIds = motorcadeRecordDO.getUserIds();
|
||||
if (StrUtil.isEmpty(userIds)) {
|
||||
throw new ServiceException("选中司机用户id不能为空");
|
||||
}
|
||||
|
||||
List<Long> ids = Convert.toList(Long.class, userIds);
|
||||
|
||||
Long motorcadeId = motorcadeRecordDO.getMotorcadeId();
|
||||
if (ObjectUtil.isNull(motorcadeId)) {
|
||||
throw new ServiceException("车队id不能为空");
|
||||
}
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = userDomainService.selectByUserId(loginUser.getUserPo().getUserId());
|
||||
if (userPo == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
|
||||
//查询车队已经发送邀请的司机记录,不在重复发送
|
||||
LambdaQueryWrapper<MotorcadeRecord> query = new LambdaQueryWrapper<>();
|
||||
query.eq(MotorcadeRecord::getDelFlag, 1);
|
||||
query.eq(MotorcadeRecord::getMotorcadeId, motorcadeRecordDO.getMotorcadeId());
|
||||
query.in(MotorcadeRecord::getUserId, ids);
|
||||
query.in(MotorcadeRecord::getMotorcadeRecordStatus, 0, 1);
|
||||
List<MotorcadeRecord> motorcadeRecordList = motorcadeRecordDomainService.selectByLambda(query);
|
||||
if (CollUtil.isNotEmpty(motorcadeRecordList)) {
|
||||
throw new ServiceException("请勿重复发送邀请,存在重复邀请司机");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<Motorcade> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Motorcade::getDelFlag, 1);
|
||||
queryWrapper.eq(Motorcade::getMotorcadeId, motorcadeRecordDO.getMotorcadeId());
|
||||
queryWrapper.eq(Motorcade::getMotorcadeDissolutionStatus, 1L);
|
||||
Motorcade motorcade = motorcadeDomainService.selectOneByLambda(queryWrapper);
|
||||
if (motorcade == null) {
|
||||
throw new ServiceException("车队信息未找到");
|
||||
}
|
||||
Map<Long, Long> idMap = new HashMap<>();
|
||||
for (Long id : ids) {
|
||||
motorcadeRecordDO.setMotorcadeId(motorcadeRecordDO.getMotorcadeId());
|
||||
motorcadeRecordDO.setUserId(id);
|
||||
motorcadeRecordDO.setMotorcadeName(motorcade.getMotorcadeName());
|
||||
motorcadeRecordDO.setMotorcadeImage(motorcade.getMotorcadeImage());
|
||||
motorcadeRecordDO.setMotorcadeDescribtion(motorcade.getMotorcadeDescribtion());
|
||||
motorcadeRecordDO.setMotorcadeHeaderName(motorcade.getMotorcadeHeaderName());
|
||||
motorcadeRecordDO.setMotorcadeScore(motorcade.getMotorcadeScore());
|
||||
MotorcadeRecord save = motorcadeRecordDomainService.save(motorcadeRecordDO);
|
||||
idMap.put(id, save.getMotorcadeRecordId());
|
||||
if (1 == configSwitch.getIsInviteTeamAuth()) {
|
||||
MotorcadeRecordDO motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
motorcadeRecordDo.setMotorcadeRecordId(save.getMotorcadeRecordId());
|
||||
motorcadeRecordDo.setMotorcadeRecordStatus(1L);
|
||||
updateStatus(motorcadeRecordDo);
|
||||
}
|
||||
}
|
||||
//消息推送
|
||||
for (Long id : ids) {
|
||||
//新增消息(推送)
|
||||
NoticeMessageLoggingDto noticeMessageLoggingDto = new NoticeMessageLoggingDto();
|
||||
noticeMessageLoggingDto.setUserId(id);
|
||||
noticeMessageLoggingDto.setNoticeMessageTitle(NoticeConstants.motorcade_invite_title);
|
||||
noticeMessageLoggingDto.setJumpPage(11);
|
||||
noticeMessageLoggingDto.setBusinessId(idMap.get(id).toString());
|
||||
String text = StringUtils.format(NoticeConstants.motorcade_invite,userPo.getUserName(), motorcade.getMotorcadeName());
|
||||
|
||||
noticeMessageLoggingDto.setNoticeMessageContent(text);
|
||||
noticeMessageLoggingDto.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
noticeMessageLoggingDto.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
noticeMessageLoggingDto.setCreateTime(new Date());
|
||||
noticeMessageLoggingDto.setMessagePushTime(new Date());
|
||||
noticeMessageLoggingDto.setNoticeMessageType(MessageTypeEnum.system_notifications.getCode());
|
||||
noticeMessageLoggingDto.setNoticeMessageName(MessageTypeEnum.system_notifications.getInfo());
|
||||
systemServiceFeign.addMessageLogging(noticeMessageLoggingDto);
|
||||
asyncJPushApplicationService.pushAndroidIndividualByAlia(NoticeConstants.audit_title, text, id.toString(), 0);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
* @param motorcadeId 车队id
|
||||
* @return
|
||||
*/
|
||||
public List<MotorcadeDriverAppPo> invitationRecordList(Long motorcadeId) {
|
||||
if(null == motorcadeId){
|
||||
throw new ServiceException("车队id不能为空");
|
||||
}
|
||||
MotorcadeRecordDO motorcadeRecordDO = new MotorcadeRecordDO();
|
||||
motorcadeRecordDO.setMotorcadeId(motorcadeId);
|
||||
List<MotorcadeDriverAppPo> motorcadeDriverAppPos = motorcadeRecordDomainService.invitationRecordList(motorcadeRecordDO);
|
||||
if (CollUtil.isEmpty(motorcadeDriverAppPos)) {
|
||||
return motorcadeDriverAppPos;
|
||||
}else {
|
||||
motorcadeDriverAppPos.forEach(e->{
|
||||
if (StringUtils.isBlank(e.getVehicleLicensePlateNumber())){
|
||||
e.setVehicleLicensePlateNumber("");
|
||||
}
|
||||
if (StringUtils.isBlank(e.getVehicleTypeName())){
|
||||
e.setVehicleTypeName("");
|
||||
}
|
||||
});
|
||||
return motorcadeDriverAppPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<MotorcadeRecordPo> invitationRecordListPC(MotorcadeRecordDto motorcadeRecordDto) {
|
||||
Long motorcadeId = motorcadeRecordDto.getMotorcadeId();
|
||||
Long userId = motorcadeRecordDto.getUserId();
|
||||
|
||||
if (ObjectUtil.isNull(motorcadeId)){
|
||||
throw new ServiceException("车队id不能为空");
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNull(userId)){
|
||||
throw new ServiceException("司机id不能为空");
|
||||
}
|
||||
MotorcadeRecordDO motorcadeRecordDO = new MotorcadeRecordDO();
|
||||
motorcadeRecordDO.setMotorcadeId(motorcadeId);
|
||||
motorcadeRecordDO.setUserId(userId);
|
||||
return motorcadeRecordDomainService.invitationRecordListPC(motorcadeRecordDO);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String addDefaultMotorcade(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
Long userId = motorcadeRecordDo.getUserId();
|
||||
if (userId == null){
|
||||
userId = userPo.getUserId();
|
||||
}
|
||||
|
||||
Motorcade motorcade = motorcadeDomainService.getDefaultMotorcade();
|
||||
if (motorcade == null){
|
||||
throw new ServiceException("默认车队不存在,请联系平台管理员添加默认车队!");
|
||||
}
|
||||
//查询车队和车队长的绑定关系记录
|
||||
LambdaQueryWrapper<MotorcadeDriver> queryWrapper = new LambdaQueryWrapper<MotorcadeDriver>();
|
||||
queryWrapper.eq(MotorcadeDriver::getMotorcadeId,motorcade.getMotorcadeId());
|
||||
queryWrapper.eq(MotorcadeDriver::getUserId,userId);
|
||||
queryWrapper.eq(MotorcadeDriver::getDelFlag,1);
|
||||
MotorcadeDriver motorcadeDriverInfo = motorcadeDriverDomainService.selectOneByLambda(queryWrapper);
|
||||
//存在绑定关系,说明已经绑定过,跳过所有操作
|
||||
if (motorcadeDriverInfo != null){
|
||||
return "";
|
||||
}
|
||||
//同意加入车队,则插入关联关系
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriverAssembler().getEntity();
|
||||
motorcadeDriver.setMotorcadeId(motorcade.getMotorcadeId());
|
||||
motorcadeDriver.setUserId(userId);
|
||||
motorcadeDriverDomainService.insert(motorcadeDriver);
|
||||
//同意加入车队,则插入关联关系
|
||||
motorcadeRecordDo = new MotorcadeRecordDO();
|
||||
motorcadeRecordDo.setMotorcadeId(motorcade.getMotorcadeId());
|
||||
motorcadeRecordDo.setUserId(userId);
|
||||
motorcadeRecordDo.setMotorcadeRecordStatus(1L);
|
||||
motorcadeRecordDo.setRecordTime(new Date());
|
||||
motorcadeRecordDomainService.insert(motorcadeRecordDo);
|
||||
//2024年3月20日 新增需求 增加代收款协议的签署 如果司机同意加入车队,则司机与该车队建立代收款协议签订
|
||||
MotorcadeRecordPo motorcadeRecordPo = new MotorcadeRecordPo();
|
||||
motorcadeRecordPo.setMotorcadeId(motorcade.getMotorcadeId());
|
||||
motorcadeRecordPo.setUserId(userId);
|
||||
signAgreement(motorcadeRecordPo);
|
||||
UserPo driverUserPo = userApplicationService.selectByUserId(userId);
|
||||
//加入车队的司机 给tms同步归属关系
|
||||
driverUserPo.setDriverEnterpriseCode(motorcade.getDriverEnterpriseCode());
|
||||
//加入车队的司机 给tms同步归属关系
|
||||
// openTmsUserApplicationService.userDriverAuth(driverUserPo);
|
||||
//查询该司机下所有车辆信息 同步tms
|
||||
R<List<VehiclePo>> vehicleR = transportFeign.getVehiclePosByUserId(userId);
|
||||
if (R.FAIL == vehicleR.getCode() || CollectionUtil.isEmpty(vehicleR.getData())){
|
||||
throw new ServiceException("请先认证车辆后再接单");
|
||||
}
|
||||
SyncTmsVehicleDTO syncTmsVehicleDTO = new SyncTmsVehicleDTO();
|
||||
syncTmsVehicleDTO.setDriverEnterpriseCode(motorcade.getDriverEnterpriseCode());
|
||||
syncTmsVehicleDTO.setVehicleList(vehicleR.getData());
|
||||
AjaxResult<?> ajaxResult = transportFeign.syncTmsVehicle(syncTmsVehicleDTO);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("同步司机车辆信息失败:" + ajaxResult.get("msg"));
|
||||
}
|
||||
//同步车队司机
|
||||
return addMotorcadeMember(motorcadeRecordPo);
|
||||
|
||||
}
|
||||
|
||||
public List<MotorcadePo> getAllOtherMotorcade() {
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null){
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
return motorcadeDomainService.getAllOtherMotorcade(userPo.getUserId());
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.mhd.common.core.domain.dto.open.SystemOpenApiLogDTO;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author ZhouGY
|
||||
* @title OpenApiLogApplicationService
|
||||
* @description: TODO
|
||||
* @date 2024/1/26 17:15
|
||||
**/
|
||||
@Service
|
||||
public class OpenApiLogApplicationService {
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* @description 保存服务日志
|
||||
* @author ZhouGY
|
||||
* @date 2024/1/26 17:17
|
||||
* @param systemOpenApiLogDTO
|
||||
*/
|
||||
public void saveLog(SystemOpenApiLogDTO systemOpenApiLogDTO) {
|
||||
// 实现日志保存逻辑
|
||||
systemServiceFeign.saveLog(systemOpenApiLogDTO);
|
||||
}
|
||||
}
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mhd.common.core.constant.SourceConstants;
|
||||
import com.mhd.common.core.domain.dto.open.*;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.SysTenantsPo;
|
||||
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.enums.TmsServerEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.system.api.event.listener.ThirdPartyServiceReqLogEvent;
|
||||
import com.mhd.common.core.utils.AESUtil;
|
||||
import com.mhd.common.core.utils.SignatureUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OpenTmsUserApplicationService {
|
||||
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private UserDriverDomainService userDriverDomainService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
|
||||
/**
|
||||
* 删除承运商或司机
|
||||
*
|
||||
* @param driverEnterpriseCode
|
||||
* @param driverCode
|
||||
*/
|
||||
public void deleteUser(String driverEnterpriseCode, String driverCode) {
|
||||
boolean flag = isPushTms();
|
||||
if (!flag){
|
||||
log.info("未开启推送TMS,不进行推送删除承运商或司机");
|
||||
return;
|
||||
}
|
||||
OpenTmsDeleteUserDto openTmsDeleteUserDto = new OpenTmsDeleteUserDto();
|
||||
openTmsDeleteUserDto.setDriverEnterpriseCode(driverEnterpriseCode);
|
||||
openTmsDeleteUserDto.setDriveCode(driverCode);
|
||||
|
||||
sendHttp(TmsServerEnum.DELETE_USER, JSONUtil.toJsonStr(openTmsDeleteUserDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/修改承运商信息
|
||||
*
|
||||
* @param driverEnterpriseCode
|
||||
* @param driverEnterpriseName
|
||||
*/
|
||||
public void userEnterpriseAuth(String driverEnterpriseCode, String driverEnterpriseName) {
|
||||
boolean flag = isPushTms();
|
||||
if (!flag){
|
||||
log.info("未开启推送TMS,不进行推送新增/修改承运商信息");
|
||||
return;
|
||||
}
|
||||
OpenTmsDriverEnterpriseDto openTmsDriverEnterpriseDto = new OpenTmsDriverEnterpriseDto();
|
||||
openTmsDriverEnterpriseDto.setDriverEnterpriseCode(driverEnterpriseCode);
|
||||
openTmsDriverEnterpriseDto.setDriverEnterpriseName(driverEnterpriseName);
|
||||
|
||||
sendHttp(TmsServerEnum.USER_ENTERPRISE_AUTH, JSONUtil.toJsonStr(openTmsDriverEnterpriseDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/修改司机信息
|
||||
* @param userPo
|
||||
*/
|
||||
public void userDriverAuth(UserPo userPo) {
|
||||
boolean flag = isPushTms();
|
||||
if (!flag){
|
||||
log.info("未开启推送TMS,不进行推送新增/修改司机信息");
|
||||
return;
|
||||
}
|
||||
OpenTmsDriverDto openTmsDriverDto = new OpenTmsDriverDto();
|
||||
openTmsDriverDto.setDriverEnterpriseCode(userPo.getDriverEnterpriseCode());
|
||||
openTmsDriverDto.setDriverCode(userPo.getUserPhone());
|
||||
openTmsDriverDto.setUserName(userPo.getUserName());
|
||||
openTmsDriverDto.setUserIdcardNumber(userPo.getUserIdcardNumber());
|
||||
|
||||
sendHttp(TmsServerEnum.USER_DRIVER_AUTH, JSONUtil.toJsonStr(openTmsDriverDto));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* @description 发送tms请求
|
||||
* @author ZhouGY
|
||||
* @date 2024/2/3 10:36
|
||||
*/
|
||||
public RespParamsDTO sendHttp(TmsServerEnum tmsServerEnum, String params) {
|
||||
R<SysTenantsPo> sysTenantsPoR = productServiceFeign.getTenantsInfoByOpen();
|
||||
if (R.SUCCESS != sysTenantsPoR.getCode()) {
|
||||
throw new ServiceException("未获取到组织配置信息");
|
||||
}
|
||||
SysTenantsPo sysTenantsPo = sysTenantsPoR.getData();
|
||||
//从三方配置表中取值
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("openApi");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
Map<String, SysDepartInterfaceInfoPo> stringSysDepartInterfaceInfoPoMap = sysDepartInterfaceInfoPos.stream().collect(Collectors.toMap(SysDepartInterfaceInfoPo::getInterfaceTypeKey, Function.identity()));
|
||||
ReqParamsDTO tmsReqParamsDTO = new ReqParamsDTO();
|
||||
tmsReqParamsDTO.setServerName(tmsServerEnum.getServerName());
|
||||
tmsReqParamsDTO.setSignType("SHA256");
|
||||
tmsReqParamsDTO.setSignTimestamp(DateUtil.format(new Date(), "yyyyMMddHHmmss"));
|
||||
tmsReqParamsDTO.setSignNonce(RandomUtil.randomString(8));
|
||||
//从三方配置表中取值
|
||||
String tmsUrl = stringSysDepartInterfaceInfoPoMap.get("tmsUrl").getInterfaceTypeValue();
|
||||
//报文加密
|
||||
String secret = stringSysDepartInterfaceInfoPoMap.get(SignatureUtil.SECRET_KEY).getInterfaceTypeValue();
|
||||
String iv = stringSysDepartInterfaceInfoPoMap.get(SignatureUtil.IV_KEY).getInterfaceTypeValue();
|
||||
log.info("加密前数据:{}", params);
|
||||
String encryptContent = AESUtil.encrypt(params, secret, iv);
|
||||
log.info("加密后数据:{}",encryptContent);
|
||||
tmsReqParamsDTO.setEncryptContent(encryptContent);
|
||||
String sign = SignatureUtil.getSign(tmsReqParamsDTO, secret);
|
||||
log.info("秘钥值:{}", secret);
|
||||
log.info("签名值:{}",sign);
|
||||
tmsReqParamsDTO.setSignValue(sign);
|
||||
String body = JSONUtil.toJsonStr(tmsReqParamsDTO);
|
||||
log.info("请求参数:{}", body);
|
||||
//执行异步事件 --- start ---
|
||||
ThirdPartyServiceReqLogDTO thirdPartyServiceReqLogDTO = new ThirdPartyServiceReqLogDTO();
|
||||
thirdPartyServiceReqLogDTO.setOrganizationId(sysTenantsPo.getOrganizationId());
|
||||
thirdPartyServiceReqLogDTO.setOrganizationName(sysTenantsPo.getOrganizationName());
|
||||
thirdPartyServiceReqLogDTO.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
thirdPartyServiceReqLogDTO.setInterfaceCode(tmsServerEnum.getServerName());
|
||||
thirdPartyServiceReqLogDTO.setInterfaceName(tmsServerEnum.getDesc());
|
||||
thirdPartyServiceReqLogDTO.setOperUrl(tmsUrl);
|
||||
thirdPartyServiceReqLogDTO.setOperParam(params);
|
||||
thirdPartyServiceReqLogDTO.setWaybillSource(SourceConstants.YONGHUZHONGTAI.getCode());
|
||||
thirdPartyServiceReqLogDTO.setWaybillSourceName(SourceConstants.YONGHUZHONGTAI.getName());
|
||||
//获取对应的关联信息
|
||||
setThirdPartyServiceReqLogOrderNumber(tmsServerEnum, thirdPartyServiceReqLogDTO);
|
||||
// try (HttpResponse httpResponse = HttpRequest.post(tmsUrl).body(body).execute()) {
|
||||
// // 检查响应是否成功获取
|
||||
// if (httpResponse == null) {
|
||||
// throw new ServiceException("获取TmsServer响应失败: HttpResponse为null");
|
||||
// }
|
||||
//
|
||||
// String rest = httpResponse.body();
|
||||
// log.info("返回结果:{}", rest);
|
||||
// thirdPartyServiceReqLogDTO.setJsonResult(rest);
|
||||
// respParamsDTO = JSONUtil.toBean(rest, RespParamsDTO.class);
|
||||
// if (respParamsDTO == null) {
|
||||
// throw new ServiceException("同步" + tmsServerEnum.getDesc() + "失败");
|
||||
// }
|
||||
// if (respParamsDTO.getCode() != 200) {
|
||||
// throw new ServiceException(respParamsDTO.getMsg());
|
||||
// }
|
||||
// } catch (Exception e) { // try-with-resources 外部的 catch 块
|
||||
// System.err.println("请求或处理响应时发生错误: " + e.getMessage());
|
||||
// throw e;
|
||||
// } finally {
|
||||
// // 这里的 finally 块只处理业务逻辑,不需要手动关闭 httpResponse
|
||||
// if (respParamsDTO != null && respParamsDTO.getCode() == 200) {
|
||||
// thirdPartyServiceReqLogDTO.setStatus(2);
|
||||
// } else {
|
||||
// thirdPartyServiceReqLogDTO.setStatus(1);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
pushLogsEvent(thirdPartyServiceReqLogDTO);
|
||||
|
||||
return new RespParamsDTO();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 执行异步事件
|
||||
* @author ZhouGY
|
||||
* @date 2024/2/16 15:41
|
||||
* @param thirdPartyServiceReqLogDTO
|
||||
*/
|
||||
private void pushLogsEvent(ThirdPartyServiceReqLogDTO thirdPartyServiceReqLogDTO ){
|
||||
//执行异步事件
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
thirdPartyServiceReqLogDTO.setCreateBy(loginUser.getUserid());
|
||||
thirdPartyServiceReqLogDTO.setCreateByName(loginUser.getUsername());
|
||||
}
|
||||
thirdPartyServiceReqLogDTO.setCreateTime(new Date());
|
||||
ThirdPartyServiceReqLogEvent thirdPartyServiceReqLogEvent = new ThirdPartyServiceReqLogEvent(thirdPartyServiceReqLogDTO);
|
||||
thirdPartyServiceReqLogEvent.setThirdPartyServiceReqLogDTO(thirdPartyServiceReqLogDTO);
|
||||
applicationEventPublisher.publishEvent(thirdPartyServiceReqLogEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @description 判断是否开启tms开关
|
||||
* @author ZhouGY
|
||||
* @date 2024/2/16 16:22
|
||||
*/
|
||||
private boolean isPushTms() {
|
||||
R<SysTenantsPo> sysTenantsPoR = productServiceFeign.getTenantsInfoByOpen();
|
||||
if (R.SUCCESS != sysTenantsPoR.getCode()) {
|
||||
throw new ServiceException("未获取到组织配置信息");
|
||||
}
|
||||
SysTenantsPo sysTenantsPo = sysTenantsPoR.getData();
|
||||
SysDepartInterfaceInfoDTO sysDepartInterfaceInfoDTO = new SysDepartInterfaceInfoDTO();
|
||||
sysDepartInterfaceInfoDTO.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
sysDepartInterfaceInfoDTO.setInterfaceType("switchConfig");
|
||||
List<SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPos = thirdPartyServiceFeign.queryListByFeign(sysDepartInterfaceInfoDTO);
|
||||
Map<String, SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoMap = sysDepartInterfaceInfoPos.stream().collect(Collectors.toMap(SysDepartInterfaceInfoPo::getInterfaceTypeKey, Function.identity()));
|
||||
SysDepartInterfaceInfoPo sysDepartInterfaceInfoPo = sysDepartInterfaceInfoPoMap.get("isPushTms");
|
||||
//是否开启推送
|
||||
if ("1".equals(sysDepartInterfaceInfoPo.getInterfaceTypeValue())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取日志关联标致
|
||||
* @author ZhouGY
|
||||
* @date 2024/2/22 16:48
|
||||
* @param tmsServerEnum
|
||||
* @param thirdPartyServiceReqLogDTO
|
||||
*/
|
||||
private void setThirdPartyServiceReqLogOrderNumber(TmsServerEnum tmsServerEnum, ThirdPartyServiceReqLogDTO thirdPartyServiceReqLogDTO){
|
||||
JSONObject jsonObject = JSONUtil.parseObj(thirdPartyServiceReqLogDTO.getOperParam());
|
||||
switch (tmsServerEnum){
|
||||
case USER_DRIVER_AUTH:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("userIdcardNumber"));
|
||||
break;
|
||||
case VEHICLE_AUTH:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("vehicleLicensePlateNumber"));
|
||||
break;
|
||||
case USER_ENTERPRISE_AUTH:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("driverEnterpriseCode"));
|
||||
break;
|
||||
case DELETE_USER:
|
||||
if (StringUtils.isNotBlank(jsonObject.getStr("driverEnterpriseCode")) && StringUtils.isNotBlank(jsonObject.getStr("driveCode"))){
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("driveCode"));
|
||||
}else if (StringUtils.isNotBlank(jsonObject.getStr("driverEnterpriseCode")) && StringUtils.isBlank(jsonObject.getStr("driveCode"))){
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("driverEnterpriseCode"));
|
||||
} else {
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("driveCode"));
|
||||
}
|
||||
break;
|
||||
case DELETE_VEHICLE:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("vehicleLicensePlateNumber"));
|
||||
break;
|
||||
case DRIVER_ROB_SINGLE:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("workCode"));
|
||||
break;
|
||||
case STATUS_FEEDBACK_FILL:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("schedulingBillCode"));
|
||||
break;
|
||||
case STATUS_FEEDBACK_SIGN:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("schedulingBillCode"));
|
||||
break;
|
||||
case RECEIPT_SIGN:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("orderNumber"));
|
||||
break;
|
||||
case CANCEL_SIGN:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("orderNumber"));
|
||||
break;
|
||||
case FREIGHT_PAYMENT:
|
||||
thirdPartyServiceReqLogDTO.setOrderNumber(jsonObject.getStr("schedulingBillCode"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+373
@@ -0,0 +1,373 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mhd.common.core.domain.dto.open.OpenDriverDto;
|
||||
import com.mhd.common.core.domain.dto.open.OpenDriverEnterpriseDto;
|
||||
import com.mhd.common.core.domain.dto.open.WlhyOpenDriverDto;
|
||||
import com.mhd.common.core.domain.dto.open.WlhyOpenDriverEnterpriseDto;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.SysTenantsPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.RegexUtil;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDomainService;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDriverDomainService;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserDriverEnterprise;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserDriverEntity;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserEntity;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverEnterpriseDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserMallDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserWlhyDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OpenUserApplicationService {
|
||||
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserApplicationService userApplicationService;
|
||||
|
||||
@Autowired
|
||||
private UserDriverDomainService userDriverDomainService;
|
||||
|
||||
@Autowired
|
||||
private MotorcadeDomainService motorcadeDomainService;
|
||||
|
||||
@Autowired
|
||||
private MotorcadeDriverDomainService motorcadeDriverDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserDriverEnterpriseDomainService userDriverEnterpriseDomainService;
|
||||
|
||||
@Resource
|
||||
private UserWlhyDomainService userWlhyDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserMallDomainService userMallDomainService;
|
||||
|
||||
/**
|
||||
* 新增/修改司机
|
||||
*
|
||||
* @param openDriverDto
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void userDriverAuth(OpenDriverDto openDriverDto) {
|
||||
//获取配置的组织ID
|
||||
R<SysTenantsPo> sysTenantsPoR = productServiceFeign.getTenantsInfoByOpen();
|
||||
if (R.SUCCESS != sysTenantsPoR.getCode()) {
|
||||
throw new ServiceException("未获取到组织配置信息");
|
||||
}
|
||||
SysTenantsPo sysTenantsPo = sysTenantsPoR.getData();
|
||||
BeanUtils.copyProperties(sysTenantsPo,openDriverDto, IgnoreNullUtil.getNullPropertyNames(sysTenantsPo));
|
||||
|
||||
//判断承运商是否存在
|
||||
UserDriverEnterprise userDriverEnterprise = userDriverEnterpriseDomainService.getInfoByEnterpriseCodeOpen(openDriverDto.getDriverEnterpriseCode(), 1);
|
||||
if (ObjectUtil.isNull(userDriverEnterprise)){
|
||||
throw new ServiceException("未找到承运商信息");
|
||||
}
|
||||
|
||||
//判断车队是否存在
|
||||
Motorcade motorcade = motorcadeDomainService.getInfoByOpen(openDriverDto.getDriverEnterpriseCode(), openDriverDto.getDataSources());
|
||||
if (ObjectUtil.isNull(motorcade)) {
|
||||
throw new ServiceException("未找到车队信息");
|
||||
}
|
||||
|
||||
//判断用户是否存在
|
||||
String driverCode = openDriverDto.getDriverCode(); //手机号
|
||||
UserEntity userEntity = userDomainService.selectUserByPhone(driverCode);
|
||||
//处理用户数据
|
||||
UserDO userDO = new UserDO();
|
||||
if (ObjectUtil.isNotNull(userEntity)) {
|
||||
userDO.setUserId(userEntity.getUserId());
|
||||
userDO.setUpdateBy(sysTenantsPo.getPrincipalId());
|
||||
userDO.setUpdateByName(sysTenantsPo.getPrincipalName());
|
||||
userDO.setUpdateTime(DateUtil.date());
|
||||
} else {
|
||||
userDO.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
userDO.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
userDO.setCreateTime(DateUtil.date());
|
||||
}
|
||||
userDO.setRoleCode(RoleEnum.DRIVER.getCode());
|
||||
userDO.setRoleName(RoleEnum.DRIVER.getName());
|
||||
userDO.setDriverEnterpriseCode(openDriverDto.getDriverEnterpriseCode());
|
||||
userDO.setDataSources(openDriverDto.getDataSources());
|
||||
userDO.setUserName(openDriverDto.getUserName());
|
||||
userDO.setUserIdcardNumber(openDriverDto.getUserIdcardNumber());
|
||||
userDO.setUserAccount(openDriverDto.getDriverCode());
|
||||
userDO.setUserPhone(openDriverDto.getDriverCode());
|
||||
userDO.setOrganizationId(sysTenantsPo.getOrganizationId());
|
||||
userDO.setOrganizationName(sysTenantsPo.getOrganizationName());
|
||||
userDO.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
userDO.setBusinessType(2);//新增司机默认承运业务
|
||||
UserPo userPo = userApplicationService.addUserByOpen(userDO);
|
||||
|
||||
//处理司机数据
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
UserDriverEntity userDriver = userDriverDomainService.getInfoByUserId(userPo.getUserId());
|
||||
if (ObjectUtil.isNotNull(userDriver)) {
|
||||
userDriverDO.setDriverId(userDriver.getDriverId());
|
||||
userDriverDO.setUpdateBy(sysTenantsPo.getPrincipalId());
|
||||
userDriverDO.setUpdateByName(sysTenantsPo.getPrincipalName());
|
||||
userDriverDO.setUpdateTime(DateUtil.date());
|
||||
} else {
|
||||
userDriverDO.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
userDriverDO.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
userDriverDO.setCreateTime(DateUtil.date());
|
||||
}
|
||||
userDriverDO.setUserId(userPo.getUserId());
|
||||
userDriverDO.setDriverEnterpriseCode(openDriverDto.getDriverEnterpriseCode());
|
||||
userDriverDO.setDataSources(openDriverDto.getDataSources());
|
||||
userDriverDomainService.saveUserDriverByOpen(userDriverDO);
|
||||
|
||||
//处理车队数据
|
||||
MotorcadeDriver motorcadeDriverInfo = motorcadeDriverDomainService.getInfoByDriveId(motorcade.getMotorcadeId(), userPo.getUserId());
|
||||
if (ObjectUtil.isNull(motorcadeDriverInfo)) {
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriver();
|
||||
motorcadeDriver.setMotorcadeId(motorcade.getMotorcadeId());
|
||||
motorcadeDriver.setUserId(userPo.getUserId());
|
||||
motorcadeDriver.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
motorcadeDriver.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
motorcadeDriver.setCreateTime(DateUtil.date());
|
||||
motorcadeDriverDomainService.insert(motorcadeDriver);
|
||||
}
|
||||
|
||||
//开始同步网货司机信息
|
||||
WlhyOpenDriverDto wlhyOpenDriverDto = new WlhyOpenDriverDto();
|
||||
BeanUtils.copyProperties(openDriverDto, wlhyOpenDriverDto);
|
||||
wlhyOpenDriverDto.setOperator(sysTenantsPo.getPrincipalId());
|
||||
wlhyOpenDriverDto.setOperatorName(sysTenantsPo.getPrincipalName());
|
||||
userWlhyDomainService.openSynchronizeDriver(wlhyOpenDriverDto, userPo);
|
||||
//同步商城用户
|
||||
UserEntity userEntityDO = new UserEntity();
|
||||
BeanUtils.copyProperties(userDO, userEntityDO);
|
||||
userMallDomainService.syncDriverUserInfo(userEntityDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/修改承运商
|
||||
* @param openDriverEnterpriseDto
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void userEnterpriseAuth(OpenDriverEnterpriseDto openDriverEnterpriseDto) {
|
||||
//获取配置的组织ID
|
||||
R<SysTenantsPo> sysTenantsPoR = productServiceFeign.getTenantsInfoByOpen();
|
||||
if (R.SUCCESS != sysTenantsPoR.getCode()) {
|
||||
throw new ServiceException("未获取到组织配置信息");
|
||||
}
|
||||
SysTenantsPo sysTenantsPo = sysTenantsPoR.getData();
|
||||
BeanUtils.copyProperties(sysTenantsPo,openDriverEnterpriseDto, IgnoreNullUtil.getNullPropertyNames(sysTenantsPo));
|
||||
|
||||
//用承运商编码注册用户账号
|
||||
String driverEnterpriseCode = openDriverEnterpriseDto.getDriverEnterpriseCode();
|
||||
UserEntity userEntity = userDomainService.selectUserByPhone(driverEnterpriseCode);
|
||||
UserDO userDO = new UserDO();
|
||||
if (ObjectUtil.isNotNull(userEntity)) {
|
||||
userDO.setUserId(userEntity.getUserId());
|
||||
userDO.setUpdateBy(sysTenantsPo.getPrincipalId());
|
||||
userDO.setUpdateByName(sysTenantsPo.getPrincipalName());
|
||||
userDO.setUpdateTime(DateUtil.date());
|
||||
} else {
|
||||
userDO.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
userDO.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
userDO.setCreateTime(DateUtil.date());
|
||||
}
|
||||
userDO.setBusinessType(2);
|
||||
userDO.setRoleCode(RoleEnum.CARRIER.getCode());
|
||||
userDO.setRoleName(RoleEnum.CARRIER.getName());
|
||||
userDO.setDriverEnterpriseCode(openDriverEnterpriseDto.getDriverEnterpriseCode());
|
||||
userDO.setDataSources(openDriverEnterpriseDto.getDataSources());
|
||||
userDO.setUserName(openDriverEnterpriseDto.getDriverEnterpriseName());
|
||||
userDO.setUserAccount(openDriverEnterpriseDto.getDriverEnterpriseCode());
|
||||
//赋值手机号
|
||||
if (StrUtil.isNotBlank(openDriverEnterpriseDto.getDriverEnterpriseCode())) {
|
||||
//调用工具类校验,手机号格式
|
||||
if (RegexUtil.isPhoneLegal(openDriverEnterpriseDto.getDriverEnterpriseCode())) {
|
||||
userDO.setUserPhone(openDriverEnterpriseDto.getDriverEnterpriseCode());
|
||||
}
|
||||
}
|
||||
userDO.setOrganizationId(sysTenantsPo.getOrganizationId());
|
||||
userDO.setOrganizationName(sysTenantsPo.getOrganizationName());
|
||||
userDO.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
UserPo userPo = userApplicationService.addUserByOpen(userDO);
|
||||
|
||||
//处理承运商信息
|
||||
UserDriverEnterprise userDriverEnterprise = new UserDriverEnterprise();
|
||||
UserDriverEnterprisePo userDriverEnterprisePo = userDriverEnterpriseDomainService.getInfoByUserId(userPo.getUserId());
|
||||
if (ObjectUtil.isNotNull(userDriverEnterprisePo)) {
|
||||
userDriverEnterprise.setUserDriverEnterpriseId(userDriverEnterprisePo.getUserDriverEnterpriseId());
|
||||
userDriverEnterprise.setUpdateBy(sysTenantsPo.getPrincipalId());
|
||||
userDriverEnterprise.setUpdateByName(sysTenantsPo.getPrincipalName());
|
||||
userDriverEnterprise.setUpdateTime(DateUtil.date());
|
||||
} else {
|
||||
userDriverEnterprise.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
userDriverEnterprise.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
userDriverEnterprise.setCreateTime(DateUtil.date());
|
||||
}
|
||||
userDriverEnterprise.setUserId(userPo.getUserId());
|
||||
userDriverEnterprise.setDriverType(1);
|
||||
userDriverEnterprise.setDriverEnterpriseName(openDriverEnterpriseDto.getDriverEnterpriseName());
|
||||
userDriverEnterprise.setDriverEnterpriseCode(openDriverEnterpriseDto.getDriverEnterpriseCode());
|
||||
userDriverEnterprise.setDataSources(openDriverEnterpriseDto.getDataSources());
|
||||
userDriverEnterpriseDomainService.saveOrUpdate(userDriverEnterprise);
|
||||
|
||||
// //处理车队长信息
|
||||
// UserDriverEnterprisePo captainInfo = userDriverEnterpriseDomainService.getCaptainInfoByUserId(userPo.getUserId());
|
||||
// if (ObjectUtil.isNotNull(captainInfo)) {
|
||||
// userDriverEnterprise.setUserDriverEnterpriseId(captainInfo.getUserDriverEnterpriseId());
|
||||
// } else {
|
||||
// userDriverEnterprise.setUserDriverEnterpriseId(null);
|
||||
// }
|
||||
// userDriverEnterprise.setDriverType(2);
|
||||
// userDriverEnterpriseDomainService.saveOrUpdate(userDriverEnterprise);
|
||||
|
||||
//处理车队信息
|
||||
Motorcade motorcade = new Motorcade();
|
||||
Motorcade motorcadeInfo = motorcadeDomainService.getInfoByOpen(openDriverEnterpriseDto.getDriverEnterpriseCode(), openDriverEnterpriseDto.getDataSources());
|
||||
if (ObjectUtil.isNotNull(motorcadeInfo)) {
|
||||
motorcade.setMotorcadeId(motorcadeInfo.getMotorcadeId());
|
||||
motorcade.setUpdateBy(sysTenantsPo.getPrincipalId());
|
||||
motorcade.setUpdateByName(sysTenantsPo.getPrincipalName());
|
||||
motorcade.setUpdateTime(DateUtil.date());
|
||||
} else {
|
||||
motorcade.setCreateBy(sysTenantsPo.getPrincipalId());
|
||||
motorcade.setCreateByName(sysTenantsPo.getPrincipalName());
|
||||
motorcade.setCreateTime(DateUtil.date());
|
||||
}
|
||||
motorcade.setMotorcadeStatus(2L);//车队默认审核中
|
||||
motorcade.setMotorcadeHeaderId(userPo.getUserId());
|
||||
motorcade.setMotorcadeHeaderName(userPo.getUserName());
|
||||
motorcade.setMotorcadeHeaderAccount(userPo.getUserAccount());
|
||||
motorcade.setMotorcadeName(openDriverEnterpriseDto.getDriverEnterpriseName() + "车队");
|
||||
motorcade.setOrganizationId(sysTenantsPo.getOrganizationId());
|
||||
motorcade.setOrganizationName(sysTenantsPo.getOrganizationName());
|
||||
motorcade.setTopOrganizationId(sysTenantsPo.getTopOrganizationId());
|
||||
motorcade.setDriverEnterpriseCode(openDriverEnterpriseDto.getDriverEnterpriseCode());
|
||||
motorcade.setDataSources(openDriverEnterpriseDto.getDataSources());
|
||||
motorcadeDomainService.saveOrUpdate(motorcade);
|
||||
|
||||
//开始同步网货企业信息
|
||||
WlhyOpenDriverEnterpriseDto wlhyOpenDriverEnterpriseDto = new WlhyOpenDriverEnterpriseDto();
|
||||
BeanUtils.copyProperties(openDriverEnterpriseDto, wlhyOpenDriverEnterpriseDto);
|
||||
wlhyOpenDriverEnterpriseDto.setOperator(sysTenantsPo.getPrincipalId());
|
||||
wlhyOpenDriverEnterpriseDto.setOperatorName(sysTenantsPo.getPrincipalName());
|
||||
userWlhyDomainService.openSynchronizeDriverEnterprise(wlhyOpenDriverEnterpriseDto,userPo);
|
||||
//同步商城用户
|
||||
UserEntity userEntityDO = new UserEntity();
|
||||
BeanUtils.copyProperties(userDO, userEntityDO);
|
||||
userMallDomainService.syncDriverUserInfo(userEntityDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除承运商/司机
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteUser(OpenDriverDto openDriverDto) {
|
||||
//1.承运商 - 删除承运商信息(若承运商下有司机,拦截不允许删除)
|
||||
if (StrUtil.isNotEmpty(openDriverDto.getDriverEnterpriseCode()) && StrUtil.isEmpty(openDriverDto.getDriverCode())) {
|
||||
UserEntity user = userDomainService.getDriverEnterpriseByCode(openDriverDto);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw new ServiceException("未找到用户信息");
|
||||
}
|
||||
|
||||
Motorcade motorcade = motorcadeDomainService.getInfoByOpen(openDriverDto.getDriverEnterpriseCode(), openDriverDto.getDataSources());
|
||||
if (ObjectUtil.isNull(motorcade)) {
|
||||
throw new ServiceException("未找到车队信息");
|
||||
}
|
||||
List<MotorcadeDriver> motorcadeDrivers = motorcadeDriverDomainService.getListByMotorcadeId(motorcade.getMotorcadeId());
|
||||
if (CollUtil.isNotEmpty(motorcadeDrivers)) {
|
||||
throw new ServiceException("承运商下存在司机信息,不允许删除");
|
||||
}
|
||||
|
||||
UserDriverPo userDriverPo = userDriverDomainService.findByUserId(user.getUserId());
|
||||
if (ObjectUtil.isNull(userDriverPo)) {
|
||||
throw new ServiceException("未找到司机信息");
|
||||
}
|
||||
|
||||
userDomainService.deleteUser(user.getUserId());
|
||||
motorcadeDomainService.deletePC(Collections.singletonList(motorcade.getMotorcadeId()));
|
||||
userDriverDomainService.deleteDriver(userDriverPo.getDriverId());
|
||||
|
||||
WlhyOpenDriverDto wlhyOpenDriverDto = new WlhyOpenDriverDto();
|
||||
BeanUtils.copyProperties(openDriverDto, wlhyOpenDriverDto);
|
||||
userWlhyDomainService.openDelDriver(wlhyOpenDriverDto);
|
||||
}
|
||||
|
||||
//2.司机 - 删除这个司机所有信息
|
||||
else if (StrUtil.isEmpty(openDriverDto.getDriverEnterpriseCode()) && StrUtil.isNotEmpty(openDriverDto.getDriverCode())) {
|
||||
UserEntity userEntity = userDomainService.selectUserByPhone(openDriverDto.getDriverCode());
|
||||
if (ObjectUtil.isNull(userEntity)) {
|
||||
throw new ServiceException("未找到用户信息");
|
||||
}
|
||||
|
||||
UserDriverPo userDriverPo = userDriverDomainService.findByUserId(userEntity.getUserId());
|
||||
if (ObjectUtil.isNull(userDriverPo)) {
|
||||
throw new ServiceException("未找到司机信息");
|
||||
}
|
||||
|
||||
userDomainService.deleteUser(userEntity.getUserId());
|
||||
motorcadeDriverDomainService.deleteByMotorcadeIdAndUserId(null, userEntity.getUserId());
|
||||
userDriverDomainService.deleteDriver(userDriverPo.getDriverId());
|
||||
|
||||
WlhyOpenDriverDto wlhyOpenDriverDto = new WlhyOpenDriverDto();
|
||||
BeanUtils.copyProperties(openDriverDto, wlhyOpenDriverDto);
|
||||
userWlhyDomainService.openDelDriver(wlhyOpenDriverDto);
|
||||
}
|
||||
|
||||
//3.承运商+司机 - 删除这个承运商下面的这个司机
|
||||
else if (StrUtil.isNotEmpty(openDriverDto.getDriverEnterpriseCode()) && StrUtil.isNotEmpty(openDriverDto.getDriverCode())) {
|
||||
Motorcade motorcade = motorcadeDomainService.getInfoByOpen(openDriverDto.getDriverEnterpriseCode(), openDriverDto.getDataSources());
|
||||
if (ObjectUtil.isNull(motorcade)) {
|
||||
throw new ServiceException("未找到车队信息");
|
||||
}
|
||||
|
||||
UserEntity userEntity = userDomainService.selectUserByPhone(openDriverDto.getDriverCode());
|
||||
if (ObjectUtil.isNull(userEntity)) {
|
||||
throw new ServiceException("未找到用户信息");
|
||||
}
|
||||
|
||||
UserDriverEntity userDriver = userDriverDomainService.getInfoByUserId(userEntity.getUserId());
|
||||
if (ObjectUtil.isNull(userDriver)) {
|
||||
throw new ServiceException("未找到司机信息");
|
||||
}
|
||||
|
||||
userDomainService.deleteUser(userEntity.getUserId());
|
||||
motorcadeDriverDomainService.deleteByMotorcadeIdAndUserId(motorcade.getMotorcadeId(), userEntity.getUserId());
|
||||
userDriverDomainService.deleteDriver(userDriver.getDriverId());
|
||||
|
||||
WlhyOpenDriverDto wlhyOpenDriverDto = new WlhyOpenDriverDto();
|
||||
BeanUtils.copyProperties(openDriverDto, wlhyOpenDriverDto);
|
||||
userWlhyDomainService.openDelDriver(wlhyOpenDriverDto);
|
||||
} else {
|
||||
throw new ServiceException("参数错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
+193
@@ -0,0 +1,193 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.mhd.common.core.domain.dto.ProjectUserDTO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.user.domain.projectUser.entity.ProjectUser;
|
||||
import com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO;
|
||||
import com.mhd.user.domain.projectUser.service.ProjectUserDomainService;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目-用户关联ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProjectUserApplicationService {
|
||||
@Autowired
|
||||
private ProjectUserDomainService projectUserDomainService;
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
@Autowired
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询项目-用户关联列表
|
||||
*/
|
||||
|
||||
public List<ProjectUserPO> queryList(ProjectUserDO projectUserDO) {
|
||||
return projectUserDomainService.queryList(projectUserDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增项目-用户关联
|
||||
*/
|
||||
public Boolean insert(ProjectUserDO projectUserDO) {
|
||||
|
||||
return projectUserDomainService.insert(projectUserDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目-用户关联
|
||||
*/
|
||||
public Boolean update(ProjectUserDO projectUserDO) {
|
||||
return projectUserDomainService.update(projectUserDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目-用户关联
|
||||
*/
|
||||
public boolean delete(Long[] projectUserIds) {
|
||||
return projectUserDomainService.delete(projectUserIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目-用户关联详细信息
|
||||
*/
|
||||
public ProjectUserPO getInfo(Long projectUserId)
|
||||
{
|
||||
return projectUserDomainService.getInfo(projectUserId);
|
||||
}
|
||||
|
||||
//获取关联子账户
|
||||
public List<UserPo> affiliateAccount(ProjectUserDO projectUserDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setTopOrganizationId(topOrganizationId);
|
||||
// userDO.setUserAccountType(4);
|
||||
userDO.setUserAccountTypeList(Arrays.asList(4,6));
|
||||
userDO.setUserInfo(projectUserDO.getUserInfo());
|
||||
List<UserPo> userPos = userDomainService.selectList(userDO);
|
||||
|
||||
ProjectUserDO projectUserDO1 = new ProjectUserDO();
|
||||
projectUserDO1.setProjectManagementId(projectUserDO.getProjectManagementId());
|
||||
List<ProjectUserPO> list = projectUserDomainService.queryList(projectUserDO1);
|
||||
List<Long> collect = list.stream().map(ProjectUserPO::getUserId).collect(Collectors.toList());
|
||||
userPos.forEach(e-> e.setIsBand(collect.contains(e.getUserId()) ? 1 : 2));
|
||||
return userPos;
|
||||
}
|
||||
|
||||
public void bindAccount(ProjectUserDTO projectUserDTO, ProjectUserDO projectUserDO) {
|
||||
Integer isBand = projectUserDO.getIsBand();
|
||||
if (isBand != null && isBand == 1){
|
||||
//新增绑定关系
|
||||
projectUserDomainService.deleteByProjectAccount(projectUserDO);
|
||||
projectUserDomainService.insert(projectUserDO);
|
||||
}
|
||||
//取消绑定
|
||||
else {
|
||||
//删除绑定关系
|
||||
projectUserDomainService.deleteByProjectAccount(projectUserDO);
|
||||
}
|
||||
productServiceFeign.bindAccount(projectUserDTO);
|
||||
}
|
||||
|
||||
|
||||
public void associatedProjects(ProjectUserDO projectUserDO) {
|
||||
Long userId = projectUserDO.getUserId();
|
||||
String userName = projectUserDO.getUserName();
|
||||
if (StringUtils.isBlank(projectUserDO.getUserName())){
|
||||
UserPo userPo = userDomainService.selectByUserId(userId);
|
||||
userName = userPo.getUserName();
|
||||
}
|
||||
|
||||
List<ProjectUserPO> projectUserPOList = projectUserDomainService.queryList(projectUserDO);
|
||||
List<Long> projectManagementIdList = projectUserDO.getProjectManagementIdList();
|
||||
List<Long> old = projectUserPOList.stream().map(ProjectUserPO::getProjectManagementId).collect(Collectors.toList());
|
||||
List<Long> addList = getStringSubList(projectManagementIdList, old);
|
||||
List<Long> delList = getStringSubList(old, projectManagementIdList);
|
||||
|
||||
List<ProjectUser> projectUserList = new ArrayList<>();
|
||||
List<ProjectUserDTO> projectUserDTOS = new ArrayList<>();
|
||||
if (addList != null && !addList.isEmpty()){
|
||||
for (Long aLong : addList) {
|
||||
ProjectUser projectUser = new ProjectUser();
|
||||
projectUser.setUserId(userId);
|
||||
projectUser.setProjectManagementId(aLong);
|
||||
projectUser.setUserName(userName);
|
||||
projectUserList.add(projectUser);
|
||||
|
||||
ProjectUserDTO projectUserDTO1 = new ProjectUserDTO();
|
||||
projectUserDTO1.setUserId(userId);
|
||||
projectUserDTO1.setProjectManagementId(aLong);
|
||||
projectUserDTO1.setIsBand(1);
|
||||
projectUserDTO1.setUserName(userName);
|
||||
projectUserDTOS.add(projectUserDTO1);
|
||||
}
|
||||
projectUserDomainService.saveBatchList(projectUserList);
|
||||
}
|
||||
|
||||
if (delList != null && !delList.isEmpty()){
|
||||
//批量删除
|
||||
projectUserDO.setProjectManagementIdList(delList);
|
||||
projectUserDomainService.deleteByProjectAccount(projectUserDO);
|
||||
for (Long aLong : delList) {
|
||||
ProjectUserDTO projectUserDTO1 = new ProjectUserDTO();
|
||||
projectUserDTO1.setUserId(userId);
|
||||
projectUserDTO1.setProjectManagementId(aLong);
|
||||
projectUserDTO1.setIsBand(2);
|
||||
projectUserDTO1.setUserName(userName);
|
||||
projectUserDTOS.add(projectUserDTO1);
|
||||
}
|
||||
}
|
||||
if (projectUserDTOS != null && !projectUserDTOS.isEmpty()){
|
||||
//处理项目数据
|
||||
productServiceFeign.bindAccountBatch(projectUserDTOS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两个集合的差集
|
||||
*/
|
||||
public static List<Long> getStringSubList(List<Long> list1, List<Long> list2) {
|
||||
if (CollectionUtil.isEmpty(list1) || list1.get(list1.size() -1) == null) {
|
||||
return null;
|
||||
}
|
||||
if (CollectionUtil.isEmpty(list2) || list2.get(list2.size() -1) == null) {
|
||||
return list1;
|
||||
}
|
||||
return list1.stream().filter(e -> {
|
||||
return !list2.contains(e);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Long> getAllByLogin() {
|
||||
ProjectUserDO projectUserDO = new ProjectUserDO();
|
||||
//当前登陆人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
projectUserDO.setUserId(loginUser.getUserid());
|
||||
List<ProjectUserPO> projectUserPOList = projectUserDomainService.queryList(projectUserDO);
|
||||
return projectUserPOList.stream().map(ProjectUserPO::getProjectManagementId).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
## 应用层 service
|
||||
|
||||
调领域层service
|
||||
|
||||
|
||||
+987
@@ -0,0 +1,987 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.base.Strings;
|
||||
import com.mhd.common.core.domain.po.*;
|
||||
import com.mhd.user.domain.roleAggregate.entity.CustomAuthRoleEntity;
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleEntity;
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleMenuEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO;
|
||||
import com.mhd.common.core.domain.dto.RoleMenuDTO;
|
||||
import com.mhd.common.core.domain.dto.UserDataPermissionQueryDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo;
|
||||
import com.mhd.user.domain.roleAggregate.service.CustomAuthRoleDomainService;
|
||||
import com.mhd.user.domain.roleAggregate.service.CustomAuthUserDomainService;
|
||||
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
||||
import com.mhd.user.domain.roleAggregate.service.RoleMenuDomainService;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserEntity;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserRoleEntity;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserRoleDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
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.IgnoreNullUtil;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.infrastructure.util.annotation.DataPermissions;
|
||||
import com.mhd.user.infrastructure.util.menu.UserRoleMenuUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONArray;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RoleApplicationService {
|
||||
|
||||
@Autowired
|
||||
private RoleDomainService roleDomainService;
|
||||
@Autowired
|
||||
private RoleMenuDomainService roleMenuDomainService;
|
||||
@Autowired
|
||||
private CustomAuthRoleDomainService customAuthRoleDomainService;
|
||||
@Autowired
|
||||
private CustomAuthUserDomainService customAuthUserDomainService;
|
||||
@Resource
|
||||
private ProductServiceFeign organizationServiceFeign;
|
||||
|
||||
@Resource
|
||||
private UserDataPermissionApplicationService userDataPermissionApplicationService;
|
||||
@Resource
|
||||
private UserRoleMenuUtils userRoleMenuUtils;
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
@Autowired
|
||||
private UserRoleDomainService userRoleDomainService;
|
||||
|
||||
/**
|
||||
* @Description 查询角色列表-分页
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:27
|
||||
*/
|
||||
public List<RolePO> selecRolePoList(RoleDo roleDo) {//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo.getUserAccountType() != null && userPo.getUserAccountType() == 5){
|
||||
roleDo.setCreateBy(userPo.getCreateBy());
|
||||
}else {
|
||||
UserDataPermissionQueryDTO userDataPermissionQueryDTO = new UserDataPermissionQueryDTO();
|
||||
userDataPermissionQueryDTO.setPermissionMenuId(roleDo.getPermissionMenuId());
|
||||
userDataPermissionQueryDTO = userDataPermissionApplicationService.getUserDataPermissionQueryDTO(userDataPermissionQueryDTO);
|
||||
BeanUtils.copyProperties(userDataPermissionQueryDTO, roleDo, IgnoreNullUtil.getNullPropertyNames(userDataPermissionQueryDTO));
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
if (ObjectUtil.isNull(roleDo.getOrganizationId())) {
|
||||
roleDo.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
if (!Strings.isNullOrEmpty(loginUserPo.getRoleCode()) && RoleEnum.SUPER_ADMIN.getCode().equals(loginUserPo.getRoleCode())) {
|
||||
//角色等级:0-无状态,1-内置角色,2-组织角色
|
||||
roleDo.setRoleGrade(1);
|
||||
}
|
||||
} else {
|
||||
roleDo.setRoleGrade(2);
|
||||
}
|
||||
}
|
||||
return roleDomainService.selecRolePoList(roleDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询角色列表-分页
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:27
|
||||
*/
|
||||
@DataPermissions(cacheName = "wlhyRole_createBy")
|
||||
public List<RolePO> getUserRolelist(RoleDo roleDo) {//获取登录人信息
|
||||
return roleDomainService.selecRolePoList(roleDo);
|
||||
}
|
||||
|
||||
public List<RolePO> queryList(RoleDo roleDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
roleDo.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
//不传等级默认为企业岗位,只查自己创建的
|
||||
if (roleDo.getRoleGrade() == null){
|
||||
roleDo.setRoleGrade(3);
|
||||
roleDo.setCreateBy(loginUserPo.getUserId());
|
||||
}else if (roleDo.getRoleGrade() == 3){
|
||||
roleDo.setCreateBy(loginUserPo.getUserId());
|
||||
}
|
||||
return roleDomainService.selecRolePoList(roleDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询角色列表-不分页
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:27
|
||||
*/
|
||||
public List<RolePO> selectList(RoleDo roleDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
if (ObjectUtil.isNull(roleDo.getOrganizationId())) {
|
||||
roleDo.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
}
|
||||
return roleDomainService.selectList(roleDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询角色列表-不分页
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:27
|
||||
*/
|
||||
public List<RolePO> roleListByOrganizationIds(RoleDo roleDo) {
|
||||
if (CollectionUtil.isNotEmpty(roleDo.getOrganizationIds())){
|
||||
roleDo.setOrganizationId(null);
|
||||
}
|
||||
return roleDomainService.selectList(roleDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询用户角色集合
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:38
|
||||
*/
|
||||
public List<Long> roleIds(RoleDo roleDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
if (ObjectUtil.isNull(roleDo.getOrganizationId())) {
|
||||
roleDo.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
if (!Strings.isNullOrEmpty(loginUserPo.getRoleCode()) && RoleEnum.SUPER_ADMIN.getCode().equals(loginUserPo.getRoleCode())) {
|
||||
//角色等级:0-无状态,1-内置角色,2-组织角色
|
||||
roleDo.setRoleGrade(1);
|
||||
}
|
||||
}
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
List<RolePO> rolePOList = roleDomainService.selecRolePoList(roleDo);
|
||||
for (RolePO rolePO : rolePOList) {
|
||||
roleIds.add(rolePO.getRoleId());
|
||||
}
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 根据角色ID查询角色信息
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:39
|
||||
*/
|
||||
public RolePO selectByRoleId(Long roleId) {
|
||||
return roleDomainService.selectByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据角色code加组织id查询角色
|
||||
* @author ZhouGY
|
||||
* @date 2023/10/10 11:17
|
||||
* @param roleCode
|
||||
* @param organizationId
|
||||
* @return List<RolePO>
|
||||
*/
|
||||
public RolePO selectByRoleCodeAndOrganizationId(String roleCode, Long organizationId) {
|
||||
return roleDomainService.selectByRoleCodeAndOrganizationId(roleCode, organizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增角色
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:40
|
||||
*/
|
||||
public int addRole(RoleDo roleDo) {
|
||||
if(Strings.isNullOrEmpty(roleDo.getRoleName())){
|
||||
throw new ServiceException("请填写名称");
|
||||
}
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
|
||||
//校验组织ID是否存在
|
||||
if(ObjectUtil.isNull(roleDo.getOrganizationId())){
|
||||
roleDo.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(roleDo.getRoleId())) {
|
||||
RolePO rolePO = roleDomainService.selectByRoleId(roleDo.getRoleId());
|
||||
if (rolePO == null) {
|
||||
throw new ServiceException("角色不存在");
|
||||
}
|
||||
roleDo.setUpdateBy(loginUser.getUserid());
|
||||
roleDo.setUpdateTime(new Date());
|
||||
return roleDomainService.updateRole(roleDo);
|
||||
} else {
|
||||
if (!Strings.isNullOrEmpty(loginUserPo.getRoleCode()) && RoleEnum.SUPER_ADMIN.getCode().equals(loginUserPo.getRoleCode())) {
|
||||
//角色等级:0-无状态,1-内置角色,2-组织角色
|
||||
roleDo.setRoleGrade(1);
|
||||
} else {
|
||||
if (roleDo.getRoleGrade() == null){
|
||||
roleDo.setRoleGrade(2);
|
||||
}
|
||||
}
|
||||
RoleDo roleDo1 = new RoleDo();
|
||||
roleDo1.setOrganizationId(roleDo.getOrganizationId());
|
||||
roleDo1.setRoleCode(roleDo.getRoleCode());
|
||||
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo1);
|
||||
if (roleEntity != null){
|
||||
throw new ServiceException("角色编码重复");
|
||||
}
|
||||
roleDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
roleDo.setCreateBy(loginUserPo.getUserId());
|
||||
roleDo.setCreateByName(loginUserPo.getUserName());
|
||||
roleDo.setCreateTime(new Date());
|
||||
roleDo.setUpdateBy(loginUserPo.getUserId());
|
||||
roleDo.setUpdateByName(loginUserPo.getUserName());
|
||||
roleDo.setUpdateTime(new Date());
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
roleDo.setDelFlag(1);
|
||||
int i = roleDomainService.addRole(roleDo);
|
||||
Long roleId = roleDo.getRoleId();
|
||||
//复制之前角色的菜单
|
||||
if (roleDo.getCopyRoleId() != null && roleDo.getCopyRoleId() != 0L){
|
||||
RoleMenuDo roleMenuDo = new RoleMenuDo();
|
||||
roleMenuDo.setRoleId(roleDo.getCopyRoleId());
|
||||
roleMenuDo.setRoleMenuClient(1);
|
||||
List<UserRoleMenuPO> userRoleMenuPOS = selectRolePositionMenuList(roleMenuDo);
|
||||
if (userRoleMenuPOS != null && userRoleMenuPOS.size() > 0){
|
||||
List<RoleMenuEntity> roleMenus = new ArrayList<>();
|
||||
for (UserRoleMenuPO userRoleMenuPO : userRoleMenuPOS) {
|
||||
RoleMenuEntity roleMenuEntity = new RoleMenuEntity();
|
||||
roleMenuEntity.setMenuId(userRoleMenuPO.getMenuId());
|
||||
roleMenuEntity.setRoleMenuClient(roleMenuDo.getRoleMenuClient());
|
||||
roleMenuEntity.setCreateBy(loginUser.getUserid());
|
||||
roleMenuEntity.setCreateByName(loginUser.getUsername());
|
||||
roleMenuEntity.setDelFlag(1);
|
||||
roleMenuEntity.setCreateTime(new Date());
|
||||
roleMenuEntity.setRoleId(roleId);
|
||||
roleMenus.add(roleMenuEntity);
|
||||
}
|
||||
roleMenuDomainService.saveBatchList(roleMenus);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 编辑角色
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:41
|
||||
*/
|
||||
public int updateRole(RoleDo roleDo) {
|
||||
return roleDomainService.updateRole(roleDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 删除角色
|
||||
* @Author Alex
|
||||
* @Date 2023/1/12 10:41
|
||||
*/
|
||||
public boolean deleteByRoleId(Long roleId) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
RoleDo roleDo = new RoleDo();
|
||||
RolePO rolePO = roleDomainService.selectByRoleId(roleId);
|
||||
if (rolePO == null) {
|
||||
throw new ServiceException("角色不存在");
|
||||
} else if (RoleEnum.MUST.getCode().equals(rolePO.getRoleCode())
|
||||
||RoleEnum.SUPER_ADMIN.getCode().equals(rolePO.getRoleCode())
|
||||
||RoleEnum.PLAT_ADMIN.getCode().equals(rolePO.getRoleCode())
|
||||
) {
|
||||
//TODO 内置角色不允许删除异常
|
||||
throw new ServiceException("内置角色不允许删除");
|
||||
} else {
|
||||
roleDo.setRoleId(roleId);
|
||||
roleDo.setDelFlag(2);
|
||||
roleDo.setUpdateTime(new Date());
|
||||
roleDo.setUpdateBy(loginUserPo.getUserId());
|
||||
roleDo.setUpdateByName(loginUserPo.getUserName());
|
||||
}
|
||||
roleDomainService.updateRole(roleDo);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 根据角色ID批量删除
|
||||
* @Author Alex
|
||||
* @Date 2023/1/9 23:33
|
||||
*/
|
||||
public int deleteByRoleIds(List<Long> ids) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
for (Long roleId : ids) {
|
||||
RoleDo roleDo = new RoleDo();
|
||||
RolePO rolePO = roleDomainService.selectByRoleId(roleId);
|
||||
if (rolePO == null) {
|
||||
throw new ServiceException("角色不存在");
|
||||
} else if (RoleEnum.MUST.getCode().equals(rolePO.getRoleCode())
|
||||
||RoleEnum.SUPER_ADMIN.getCode().equals(rolePO.getRoleCode())
|
||||
||RoleEnum.PLAT_ADMIN.getCode().equals(rolePO.getRoleCode())
|
||||
) {
|
||||
//TODO 内置角色不允许删除异常
|
||||
throw new ServiceException("角色不存在");
|
||||
} else {
|
||||
roleDo.setRoleId(roleId);
|
||||
roleDo.setDelFlag(2);
|
||||
roleDo.setUpdateTime(new Date());
|
||||
roleDo.setUpdateBy(loginUserPo.getUserId());
|
||||
roleDo.setUpdateByName(loginUserPo.getUserName());
|
||||
}
|
||||
roleDomainService.updateRole(roleDo);
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色菜单列表
|
||||
*
|
||||
* @param roleMenuDo
|
||||
* @return
|
||||
*/
|
||||
public List<UserRoleMenuPO> selectRoleMenuList(RoleMenuDo roleMenuDo) {
|
||||
List<UserRoleMenuPO> userRoleMenuPOS = roleMenuDomainService.selectRoleMenuList(roleMenuDo);
|
||||
userRoleMenuUtils.packKey(userRoleMenuPOS, "02-");
|
||||
List<MenuVo> menuVoList = roleMenuDo.getMenuVoList();
|
||||
return userRoleMenuUtils.matchingData(userRoleMenuPOS, menuVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询职务菜单列表
|
||||
*
|
||||
* @param roleMenuDo
|
||||
* @return
|
||||
*/
|
||||
public List<UserRoleMenuPO> selectRolePositionMenuList(RoleMenuDo roleMenuDo) {
|
||||
List<UserRoleMenuPO> userRoleMenuPOS = roleMenuDomainService.selectRoleMenuList(roleMenuDo);
|
||||
userRoleMenuPOS = userRoleMenuPOS.parallelStream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
return userRoleMenuUtils.packKey(userRoleMenuPOS, "02-");
|
||||
}
|
||||
|
||||
public int updateShipperRoleMenu(RoleMenuDo roleMenuDo){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
List<RolePO> roleListByUserId = roleDomainService.getRoleListByUserId(loginUser.getUserPo().getUserId());
|
||||
List<String> roleCodeList = roleListByUserId.stream().map(RolePO::getRoleCode).collect(Collectors.toList());
|
||||
if (!roleCodeList.contains(RoleEnum.COMPANY.getCode())){
|
||||
throw new ServiceException("不允许非企业货主操作!");
|
||||
}
|
||||
return this.updateRoleMenu(roleMenuDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 重置角色菜单
|
||||
* @Author Alex
|
||||
* @Date 2023/1/9 23:18
|
||||
*/
|
||||
public int updateRoleMenu(RoleMenuDo roleMenuDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if ((roleMenuDo.getMenuIds() == null || roleMenuDo.getMenuIds().isEmpty()) || roleMenuDo.getIdKeyList() != null && !roleMenuDo.getIdKeyList().isEmpty()) {
|
||||
userRoleMenuUtils.removeKey(roleMenuDo);
|
||||
}
|
||||
|
||||
roleMenuDomainService.removeByRoleId(roleMenuDo);
|
||||
//未选择菜单的时候直接返回成功,不需要保存新的菜单并返回结果
|
||||
if (roleMenuDo.getMenuIds() == null || roleMenuDo.getMenuIds().isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
for (Long menuId : roleMenuDo.getMenuIds()) {
|
||||
RoleMenuDo roleMenuDo1 = new RoleMenuDo();
|
||||
roleMenuDo1.setMenuId(menuId);
|
||||
roleMenuDo1.setRoleMenuClient(roleMenuDo.getRoleMenuClient());
|
||||
roleMenuDo1.setCreateBy(loginUser.getUserid());
|
||||
roleMenuDo1.setCreateByName(loginUser.getUsername());
|
||||
roleMenuDo1.setDelFlag(1);
|
||||
roleMenuDo1.setCreateTime(new Date());
|
||||
roleMenuDo1.setRoleId(roleMenuDo.getRoleId());
|
||||
roleMenuDomainService.addRoleMenu(roleMenuDo1);
|
||||
}
|
||||
return roleMenuDo.getMenuIds().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 租户配置角色
|
||||
* @Author Alex
|
||||
* @Date 2023/1/9 22:41
|
||||
*/
|
||||
@Transactional
|
||||
public int assignOrganizationRoles(RoleDo roleDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
if (ObjectUtil.isNull(roleDo.getOrganizationId())) {
|
||||
throw new ServiceException("组织ID不存在");
|
||||
}
|
||||
Long loginUserId = loginUserPo.getUserId();
|
||||
String loginUserName = loginUserPo.getUserName();
|
||||
Date todayTime = new Date();
|
||||
//绝对内置角色不允许移除
|
||||
List<String> roleCodes1 = roleDo.getRoleCodeList();
|
||||
if (!roleCodes1.contains("plat_admin") || !roleCodes1.contains("must")){
|
||||
//查询初始角色列表
|
||||
RoleDo roleDo1 = new RoleDo();
|
||||
roleDo1.setOrganizationId(1L);
|
||||
List<RolePO> rolePOS = roleDomainService.selectList(roleDo1);
|
||||
//根据roleCode去重
|
||||
Set<RolePO> roleSet = new HashSet<>(rolePOS);
|
||||
rolePOS = new ArrayList<>(roleSet);
|
||||
if (!roleCodes1.contains("plat_admin")){
|
||||
for (RolePO rolePO : rolePOS) {
|
||||
if ("plat_admin".equals(rolePO.getRoleCode())){
|
||||
throw new ServiceException("配置的角色必须包含"+rolePO.getRoleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!roleCodes1.contains("must")){
|
||||
for (RolePO rolePO : rolePOS) {
|
||||
if ("must".equals(rolePO.getRoleCode())){
|
||||
throw new ServiceException("配置的角色必须包含"+rolePO.getRoleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//根据组织查询所有的内置角色
|
||||
RoleDo roleDo1 = new RoleDo();
|
||||
roleDo1.setRoleGrade(1);
|
||||
roleDo1.setDelFlag(1);
|
||||
roleDo1.setOrganizationId(roleDo.getOrganizationId());
|
||||
List<RoleEntity> roleS = roleDomainService.queryList(roleDo1);
|
||||
//查询所有的内置角色(初始内置角色)
|
||||
roleDo1.setOrganizationId(1L);
|
||||
roleDo1.setDelFlag(1);
|
||||
List<RoleEntity> entities = roleDomainService.queryList(roleDo1);
|
||||
Map<String, RoleEntity> map = new HashMap<>();
|
||||
entities.forEach(e->map.put(e.getRoleCode(),e));
|
||||
//新增新配置的角色
|
||||
Map<String, RoleEntity> entityMap = new HashMap<>();
|
||||
List<String> roleCodes = roleDo.getRoleCodeList();
|
||||
for (String roleCode : roleCodes) {
|
||||
RoleEntity role = map.get(roleCode);
|
||||
RoleEntity roleEntity = new RoleEntity();
|
||||
roleEntity.setDelFlag(1);
|
||||
roleEntity.setRoleGrade(1);
|
||||
roleEntity.setParentRoleId(role.getRoleId());
|
||||
roleEntity.setRoleCode(roleCode);
|
||||
roleEntity.setRoleName(role.getRoleName());
|
||||
roleEntity.setOrganizationId(roleDo.getOrganizationId());
|
||||
roleEntity.setRoleType(roleDo.getRoleType());
|
||||
|
||||
roleEntity.setCreateBy(loginUserId);
|
||||
roleEntity.setCreateTime(todayTime);
|
||||
roleEntity.setCreateByName(loginUserName);
|
||||
entityMap.put(roleCode, roleEntity);
|
||||
}
|
||||
//将所有的角色进行更新(有的恢复,没有的进行逻辑删除)
|
||||
List<RoleEntity> list = new ArrayList<>();
|
||||
List<String> delCodes = new ArrayList<>();
|
||||
List<String> recoverCodes = new ArrayList<>();
|
||||
for (RoleEntity roleEntity : roleS) {
|
||||
if (roleCodes.contains(roleEntity.getRoleCode())){
|
||||
recoverCodes.add(roleEntity.getRoleCode());
|
||||
roleEntity.setDelFlag(1);
|
||||
roleEntity.setUpdateTime(todayTime);
|
||||
roleEntity.setUpdateBy(loginUserId);
|
||||
roleEntity.setUpdateByName(loginUserName);
|
||||
entityMap.remove(roleEntity.getRoleCode());
|
||||
}else {
|
||||
delCodes.add(roleEntity.getRoleCode());
|
||||
roleEntity.setUpdateTime(todayTime);
|
||||
roleEntity.setUpdateBy(loginUserId);
|
||||
roleEntity.setUpdateByName(loginUserName);
|
||||
roleEntity.setDelFlag(2);
|
||||
}
|
||||
list.add(roleEntity);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(delCodes)){
|
||||
//获取所有的子组织
|
||||
AjaxResult result = organizationServiceFeign.getOrganizationIdsByOrganizationId(roleDo.getOrganizationId());
|
||||
List<Long> longs = JSON.parseArray(JSONObject.toJSONString(result.get("data")), Long.class);
|
||||
if (CollectionUtil.isNotEmpty(longs) && longs.contains(roleDo.getOrganizationId())){
|
||||
longs.remove(roleDo.getOrganizationId());
|
||||
if (CollectionUtil.isNotEmpty(longs)){
|
||||
//获取所有子组织需要删除的角色id
|
||||
List<RoleEntity> delList = roleDomainService.selectByCodesAndOrganizationIds(delCodes , longs);
|
||||
//获取所有子组织需要恢复的角色id
|
||||
List<RoleEntity> recoverList = roleDomainService.selectByCodesAndOrganizationIds(delCodes , longs);
|
||||
if (CollectionUtil.isNotEmpty(delList)){
|
||||
for (RoleEntity roleEntity : delList) {
|
||||
roleEntity.setDelFlag(2);
|
||||
roleEntity.setUpdateTime(todayTime);
|
||||
roleEntity.setUpdateBy(loginUserId);
|
||||
roleEntity.setUpdateByName(loginUserName);
|
||||
list.add(roleEntity);
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(recoverList)){
|
||||
for (RoleEntity roleEntity : recoverList) {
|
||||
roleEntity.setDelFlag(1);
|
||||
roleEntity.setUpdateTime(todayTime);
|
||||
roleEntity.setUpdateBy(loginUserId);
|
||||
roleEntity.setUpdateByName(loginUserName);
|
||||
list.add(roleEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//批量更新
|
||||
roleDomainService.updateBatchListById(list);
|
||||
//批量新增
|
||||
List<RoleEntity> entityList = new ArrayList<>();
|
||||
entityList.addAll(entityMap.values());
|
||||
roleDomainService.saveBatchList(entityList);
|
||||
|
||||
//查询新的内置角色,给租户账号分配上去
|
||||
RoleDo roleDo2 = new RoleDo();
|
||||
roleDo2.setRoleGrade(1);
|
||||
roleDo2.setDelFlag(1);
|
||||
roleDo2.setOrganizationId(roleDo.getOrganizationId());
|
||||
List<RoleEntity> role2 = roleDomainService.queryList(roleDo2);
|
||||
if (role2 != null && !role2.isEmpty()){
|
||||
//获取当前租户账号
|
||||
UserEntity userEntity = userDomainService.selectByTopOrganizationId(roleDo.getOrganizationId());
|
||||
if (userEntity != null){
|
||||
if (userEntity.getUserId() != null){
|
||||
//清理所有角色数据
|
||||
userRoleDomainService.deleteByUserId(userEntity.getUserId());
|
||||
List<UserRoleEntity> userRoleEntityList = new ArrayList<>();
|
||||
for (RoleEntity roleEntity : role2) {
|
||||
UserRoleEntity userRoleEntity = new UserRoleEntity();
|
||||
userRoleEntity.setRoleId(roleEntity.getRoleId());
|
||||
userRoleEntity.setUserId(userEntity.getUserId());
|
||||
userRoleEntity.setCreateByName(loginUserPo.getUserName());
|
||||
userRoleEntity.setUpdateByName(loginUserPo.getUserName());
|
||||
userRoleEntity.setCreateTime(new Date());
|
||||
userRoleEntity.setUpdateTime(new Date());
|
||||
userRoleEntity.setDelFlag(1);
|
||||
userRoleEntityList.add(userRoleEntity);
|
||||
}
|
||||
userRoleDomainService.saveBatchList(userRoleEntityList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色菜单权限
|
||||
* 1.查询新增的角色对应的所有的菜单权限
|
||||
* 2.获取该租户所有的菜单 roleDo.getOrganizationId()
|
||||
* 3.赋值给新的角色
|
||||
*
|
||||
*/
|
||||
Map<Long, MenuPo> collect = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(entityList)){
|
||||
List<Long> codeList = entityList.stream().map(RoleEntity::getParentRoleId).collect(Collectors.toList());
|
||||
Map<Long, Long> maps = entityList.stream().collect(Collectors.toMap(RoleEntity::getParentRoleId, RoleEntity::getRoleId, (key1, key2) -> key2));
|
||||
List<RoleMenuDo> roleMenuDoList = roleMenuDomainService.selectByRoleList(codeList);
|
||||
List<RoleMenuEntity> roleMenuEntityList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(roleMenuDoList)){
|
||||
List<Long> sourceMenuId = new ArrayList<>();
|
||||
roleMenuDoList.forEach(e->sourceMenuId.addAll(e.getMenuIds()));
|
||||
//根据所有的来源id查询所有的菜单数据
|
||||
RoleMenuDTO roleMenuDTO = new RoleMenuDTO();
|
||||
roleMenuDTO.setOrganizationId(roleDo.getOrganizationId());
|
||||
roleMenuDTO.setSourceIdList(sourceMenuId);
|
||||
R<List<MenuPo>> menuPoList = organizationServiceFeign.getMenuBySourceId(roleMenuDTO);
|
||||
if (menuPoList.getCode() == R.FAIL){
|
||||
throw new ServiceException(menuPoList.getMsg());
|
||||
}
|
||||
List<MenuPo> data = menuPoList.getData();
|
||||
collect = data.stream().collect(Collectors.toMap(MenuPo::getSourceId, Function.identity(), (key1, key2) -> key2));
|
||||
for (RoleMenuDo roleMenuDo : roleMenuDoList) {
|
||||
Long roleId = maps.get(roleMenuDo.getRoleId());
|
||||
List<Long> menuIds = roleMenuDo.getMenuIds();
|
||||
if (CollectionUtil.isNotEmpty(menuIds)){
|
||||
for (Long menuId : menuIds) {
|
||||
MenuPo menuPo = collect.get(menuId);
|
||||
if (menuPo != null){
|
||||
RoleMenuEntity roleMenuEntity = new RoleMenuEntity();
|
||||
roleMenuEntity.setMenuId(menuPo.getMenuId());
|
||||
roleMenuEntity.setRoleId(roleId);
|
||||
roleMenuEntity.setCreateTime(todayTime);
|
||||
roleMenuEntity.setCreateBy(loginUserId);
|
||||
roleMenuEntity.setCreateByName(loginUserName);
|
||||
roleMenuEntityList.add(roleMenuEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(roleMenuDoList)){
|
||||
roleMenuDomainService.saveBatchList(roleMenuEntityList);
|
||||
}
|
||||
/**
|
||||
* 配置按钮权限
|
||||
* 1.查询原始角色的所有按钮权限/addRoleByOrganizationId/{organizationId}
|
||||
* 2.给新角色配置所有的按钮权限
|
||||
*/
|
||||
List<CustomAuthRoleEntity> customAuthRoleEntityList = customAuthRoleDomainService.selectByRoleIdList(codeList);
|
||||
if (CollectionUtil.isNotEmpty(customAuthRoleEntityList) && !collect.isEmpty()){
|
||||
for (CustomAuthRoleEntity customAuthRoleEntity : customAuthRoleEntityList) {
|
||||
Long roleId = maps.get(customAuthRoleEntity.getRoleId());
|
||||
customAuthRoleEntity.setRoleId(roleId);
|
||||
customAuthRoleEntity.setCustomAuthRoleId(null);
|
||||
customAuthRoleEntity.setCreateBy(loginUserId);
|
||||
customAuthRoleEntity.setCreateByName(loginUserName);
|
||||
customAuthRoleEntity.setCreateTime(todayTime);
|
||||
Long menuId = customAuthRoleEntity.getMenuId();
|
||||
customAuthRoleEntity.setMenuId(collect.get(menuId).getMenuId());
|
||||
}
|
||||
}
|
||||
customAuthRoleDomainService.saveBatch(customAuthRoleEntityList);
|
||||
}
|
||||
|
||||
return roleCodes.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 配置角色/用户权限
|
||||
* @Author Alex
|
||||
* @Date 2022/12/11 22:07
|
||||
*/
|
||||
public int assignCustomAuthByRoleOrUserId(CustomAuthDO customAuthDO) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
customAuthDO.setCreateBy(loginUserPo.getUserId());
|
||||
customAuthDO.setCreateByName(loginUserPo.getUserName());
|
||||
customAuthDO.setCreateTime(new Date());
|
||||
customAuthDO.setDelFlag(1);
|
||||
|
||||
//角色表ID为空时,维护用户
|
||||
if (customAuthDO.getRoleId() == null) {
|
||||
customAuthUserDomainService.deleteCustomAuthUserByUserId(customAuthDO);
|
||||
return customAuthUserDomainService.assignCustomAuthByUserId(customAuthDO);
|
||||
} else {
|
||||
//用户表ID为空时,维护角色
|
||||
customAuthRoleDomainService.deleteCustomAuthRoleByRoleId(customAuthDO);
|
||||
return customAuthRoleDomainService.assignCustomAuthByRoleId(customAuthDO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询角色/用户权限列表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/11 22:08
|
||||
*/
|
||||
public List<CustomAuthRoleOrUserPO> getCustomAuthByRoleOrUserId(CustomAuthDO customAuthDO) {
|
||||
List<CustomAuthRoleOrUserPO> customAuthRoleOrUserPOList = customAuthUserDomainService.getCustomAuthByRoleOrUserId(customAuthDO);
|
||||
if (CollectionUtil.isEmpty(customAuthRoleOrUserPOList)){
|
||||
customAuthRoleOrUserPOList = customAuthUserDomainService.getCustomAuthByRole(customAuthDO);
|
||||
if (CollectionUtil.isNotEmpty(customAuthRoleOrUserPOList)){
|
||||
//合并不同角色的相同菜单的按钮权限
|
||||
customAuthRoleOrUserPOList = mergeMenu(customAuthRoleOrUserPOList);
|
||||
}
|
||||
}
|
||||
return customAuthRoleOrUserPOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 合并相同菜单的按钮权限
|
||||
* @Author Alex
|
||||
* @Date 2022/12/11 22:08
|
||||
*/
|
||||
public List<CustomAuthRoleOrUserPO> mergeMenu(List<CustomAuthRoleOrUserPO> customAuthRoleOrUserPOList) {
|
||||
List<CustomAuthRoleOrUserPO> list = new ArrayList<>();
|
||||
Map<Long, List<CustomAuthRoleOrUserPO>> collect = customAuthRoleOrUserPOList.stream().collect(Collectors.groupingBy(CustomAuthRoleOrUserPO::getMenuId));
|
||||
for (Long aLong : collect.keySet()) {
|
||||
List<CustomAuthRoleOrUserPO> customAuthRoleOrUserPOS = collect.get(aLong);
|
||||
if (customAuthRoleOrUserPOS.size() > 1){
|
||||
CustomAuthRoleOrUserPO customAuthRoleOrUserPO1 = new CustomAuthRoleOrUserPO();
|
||||
for (CustomAuthRoleOrUserPO customAuthRoleOrUserPO : customAuthRoleOrUserPOS) {
|
||||
if (customAuthRoleOrUserPO1.getMenuId() == 0L){
|
||||
BeanUtils.copyProperties(customAuthRoleOrUserPO, customAuthRoleOrUserPO1);
|
||||
}else {
|
||||
//合并权限
|
||||
String buttonCustom = mergeCustom(customAuthRoleOrUserPO1.getButtonJson(), customAuthRoleOrUserPO.getButtonJson(), 1);
|
||||
customAuthRoleOrUserPO1.setButtonJson(buttonCustom);
|
||||
String tableCustom = mergeCustom(customAuthRoleOrUserPO1.getTableJson(), customAuthRoleOrUserPO.getTableJson(), 2);
|
||||
customAuthRoleOrUserPO1.setTableJson(tableCustom);
|
||||
String fromCustom = mergeCustom(customAuthRoleOrUserPO1.getFormJson(), customAuthRoleOrUserPO.getFormJson(), 3);
|
||||
customAuthRoleOrUserPO1.setFormJson(fromCustom);
|
||||
}
|
||||
}
|
||||
list.add(customAuthRoleOrUserPO1);
|
||||
}else {
|
||||
list.addAll(customAuthRoleOrUserPOS);
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 合并相同菜单的按钮权限
|
||||
* @param type 1-按钮,2-表单,3-form
|
||||
* @Author Alex
|
||||
* @Date 2022/12/11 22:08
|
||||
*/
|
||||
public String mergeCustom(String custom1, String custom2, Integer type) {
|
||||
JSONArray jsonArray1 = new JSONArray(custom1);
|
||||
List<Map<String, Object>> list1 = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray1.length(); i++) {
|
||||
org.json.JSONObject jsonObject = jsonArray1.getJSONObject(i);
|
||||
Map<String, Object> map = jsonObject.toMap();
|
||||
list1.add(map);
|
||||
}
|
||||
JSONArray jsonArray2 = new JSONArray(custom2);
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray2.length(); i++) {
|
||||
org.json.JSONObject jsonObject = jsonArray2.getJSONObject(i);
|
||||
Map<String, Object> map = jsonObject.toMap();
|
||||
list2.add(map);
|
||||
}
|
||||
if (type == 1){
|
||||
return listToString(list1, list2, "name");
|
||||
}else if (type == 2){
|
||||
return listToString(list1, list2, "field");
|
||||
}else {
|
||||
return listToString(list1, list2, "prop");
|
||||
}
|
||||
}
|
||||
|
||||
public String listToString(List<Map<String, Object>> list1, List<Map<String, Object>> list2, String key) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list.addAll(list1);
|
||||
list.addAll(list2);
|
||||
Map<String, Map<String, Object>> map = new HashMap();
|
||||
for (Map<String, Object> stringObjectMap : list) {
|
||||
String name = stringObjectMap.get(key).toString();
|
||||
Map<String, Object> stringObjectMap1 = map.get(name);
|
||||
if (stringObjectMap1 == null){
|
||||
map.put(name, stringObjectMap);
|
||||
}else {
|
||||
String show = stringObjectMap.get("show").toString();
|
||||
if (show.equals("1")){
|
||||
map.put(name, stringObjectMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
list = new ArrayList<>();
|
||||
list.addAll(map.values());
|
||||
JSONArray jsonArray = new JSONArray(list);
|
||||
return jsonArray.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description 查询角色权限列表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/11 22:08
|
||||
*/
|
||||
public CustomAuthRoleOrUserPO getCustomAuthByRoleId(CustomAuthDO customAuthDO) {
|
||||
if (customAuthDO.getMenuId() == null){
|
||||
throw new ServiceException("请选择菜单!");
|
||||
}
|
||||
if (customAuthDO.getRoleId() == null){
|
||||
throw new ServiceException("请选择角色!");
|
||||
}
|
||||
CustomAuthRoleOrUserPO customAuthPO = customAuthUserDomainService.getCustomAuthByRoleId(customAuthDO);
|
||||
return customAuthPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询角色/用户权限列表
|
||||
* @Author Alex
|
||||
* @Date 2022/12/14 18:34
|
||||
*/
|
||||
public CustomAuthRoleOrUserPO getCustomAuthMenuByRoleOrUserId(CustomAuthDO customAuthDO) {
|
||||
if (ObjectUtil.isNull(customAuthDO.getMenuId())) {
|
||||
throw new ServiceException("请选择菜单!");
|
||||
}
|
||||
CustomAuthRoleOrUserPO customAuthRoleOrUserPO = customAuthUserDomainService.getCustomAuthMenuByRoleOrUserId(customAuthDO);
|
||||
if (ObjectUtil.isNull(customAuthRoleOrUserPO)) {
|
||||
customAuthRoleOrUserPO = customAuthRoleDomainService.getCustomAuthMenuByRoleOrUserId(customAuthDO);
|
||||
}
|
||||
return customAuthRoleOrUserPO;
|
||||
}
|
||||
|
||||
public String findRoleNameByRoleIds(List<Long> roleIds) {
|
||||
return roleDomainService.findRoleNameByRoleIds(roleIds);
|
||||
}
|
||||
|
||||
public RoleEntity selectByOrganizationIdAndRoleCode(RoleDo roleDo) {
|
||||
return roleDomainService.selectByOrganizationIdAndRoleCode(roleDo);
|
||||
}
|
||||
|
||||
public List<RolePO> getBuiltinRoleList(RoleDo roleDo) {
|
||||
if (roleDo.getOrganizationId() == null){
|
||||
return null;
|
||||
}
|
||||
return roleDomainService.selectList(roleDo);
|
||||
}
|
||||
|
||||
|
||||
public int updateRoleMenus(RoleMenuDo roleMenuDo) {
|
||||
//获取登录人信息
|
||||
/*LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}*/
|
||||
roleMenuDomainService.removeByRoleId(roleMenuDo);
|
||||
//角色菜单集合
|
||||
List<RoleMenuEntity> roleMenuEntityList = new ArrayList<>();
|
||||
for (Long menuId : roleMenuDo.getMenuIds()) {
|
||||
RoleMenuEntity roleMenuEntity = new RoleMenuEntity();
|
||||
roleMenuEntity.setMenuId(menuId);
|
||||
// roleMenuEntity.setCreateBy(loginUser.getUserid());
|
||||
// roleMenuEntity.setCreateByName(loginUser.getUsername());
|
||||
roleMenuEntity.setDelFlag(1);
|
||||
roleMenuEntity.setCreateTime(new Date());
|
||||
roleMenuEntity.setRoleId(roleMenuDo.getRoleId());
|
||||
roleMenuEntityList.add(roleMenuEntity);
|
||||
}
|
||||
//批量保存
|
||||
roleMenuDomainService.saveBatchList(roleMenuEntityList);
|
||||
return roleMenuDo.getMenuIds().size();
|
||||
}
|
||||
|
||||
|
||||
public int addList(RoleDo roleDo) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
if (!Strings.isNullOrEmpty(loginUserPo.getRoleCode()) && RoleEnum.SUPER_ADMIN.getCode().equals(loginUserPo.getRoleCode())) {
|
||||
//角色等级:0-无状态,1-内置角色,2-组织角色
|
||||
roleDo.setRoleGrade(1);
|
||||
} else {
|
||||
roleDo.setRoleGrade(2);
|
||||
}
|
||||
List<Long> organizationIds = roleDo.getOrganizationIds();
|
||||
AjaxResult result = organizationServiceFeign.getOrganizationIdsByOrganizationIds(organizationIds);
|
||||
List<Long> longs = JSON.parseArray(JSONObject.toJSONString(result.get("data")), Long.class);
|
||||
|
||||
List<RoleEntity> list = roleDomainService.selectByOrganizations(roleDo.getRoleCode() , longs);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
AjaxResult info = organizationServiceFeign.getInfo(list.get(0).getOrganizationId());
|
||||
OrganizationPo organizationPo = JSON.parseObject(JSONObject.toJSONString(info.get("data")), OrganizationPo.class);
|
||||
throw new ServiceException("组织为"+organizationPo.getOrganizationName()+"的角色编码已存在");
|
||||
|
||||
}
|
||||
List<RoleEntity> roleEntityList = new ArrayList<>();
|
||||
for (Long organizationId : organizationIds) {
|
||||
RoleEntity roleEntity = new RoleEntity();
|
||||
BeanUtils.copyProperties(roleDo , roleEntity);
|
||||
roleEntity.setOrganizationId(organizationId);
|
||||
roleEntity.setCreateBy(loginUserPo.getUserId());
|
||||
roleEntity.setCreateByName(loginUserPo.getUserName());
|
||||
roleEntity.setCreateTime(new Date());
|
||||
roleEntity.setUpdateBy(loginUserPo.getUserId());
|
||||
roleEntity.setUpdateByName(loginUserPo.getUserName());
|
||||
roleEntity.setUpdateTime(new Date());
|
||||
//删除标记:0-无状态,1-正常,2-已删除
|
||||
roleEntity.setDelFlag(1);
|
||||
roleEntityList.add(roleEntity);
|
||||
}
|
||||
roleDomainService.saveBatchList(roleEntityList);
|
||||
|
||||
return roleEntityList.size();
|
||||
}
|
||||
|
||||
public List<RoleEntity> getRolesByByOrganizationId(Long organizationId) {
|
||||
//根据组织id查询所有的内置角色
|
||||
RoleDo roleDo = new RoleDo();
|
||||
roleDo.setOrganizationId(organizationId);
|
||||
roleDo.setRoleGrade(1);
|
||||
roleDo.setDelFlag(1);
|
||||
List<RoleEntity> list = roleDomainService.queryList(roleDo);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存角色对应APP菜单权限
|
||||
* @param roleMenuDo
|
||||
* @return
|
||||
*/
|
||||
public int saveAppRoleMenu(RoleMenuDo roleMenuDo) {
|
||||
if(roleMenuDo.getRoleId()==null){
|
||||
throw new ServiceException("角色id不能为空");
|
||||
}
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//先按照组织删除角色对应的菜单
|
||||
// roleMenuDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
roleMenuDo.setRoleMenuClient(2);
|
||||
roleMenuDomainService.removeByRoleId(roleMenuDo);
|
||||
for (Long menuId : roleMenuDo.getMenuIds()) {
|
||||
RoleMenuDo roleMenuDo1 = new RoleMenuDo();
|
||||
roleMenuDo1.setMenuId(menuId);
|
||||
roleMenuDo1.setCreateBy(loginUser.getUserid());
|
||||
roleMenuDo1.setCreateByName(loginUser.getUsername());
|
||||
roleMenuDo1.setDelFlag(1);
|
||||
roleMenuDo1.setRoleMenuClient(2);
|
||||
roleMenuDo1.setCreateTime(new Date());
|
||||
roleMenuDo1.setRoleId(roleMenuDo.getRoleId());
|
||||
roleMenuDomainService.addRoleMenu(roleMenuDo1);
|
||||
}
|
||||
return roleMenuDo.getMenuIds().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色配置的APP菜单
|
||||
* @param roleMenuDo
|
||||
* @return
|
||||
*/
|
||||
public List<UserRoleMenuPO> selectRoleAppMenuList(RoleMenuDo roleMenuDo) {
|
||||
//增加APP菜单条件
|
||||
roleMenuDo.setRoleMenuClient(2);
|
||||
return roleMenuDomainService.selectRoleMenuList(roleMenuDo);
|
||||
}
|
||||
|
||||
public List<RolePO> getRoleListByUserId(Long userId) {
|
||||
return roleDomainService.getRoleListByUserId(userId);
|
||||
}
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.thirdparty.*;
|
||||
import com.mhd.common.core.domain.thirdparty.*;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 调用三方接口ApplicationService
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-17
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThirdPartyApplicationService {
|
||||
|
||||
@Resource
|
||||
private CommonApplicationService commonApplicationService;
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
* 身份证OCR识别
|
||||
*
|
||||
* @param idocrdto
|
||||
* @return
|
||||
*/
|
||||
public IDOCRPo identityOcr(IDOCRDTO idocrdto) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getIdcardOcrSwitch() == 2) {
|
||||
return new IDOCRPo();
|
||||
}
|
||||
IDOCRPo idocrPo = new IDOCRPo();
|
||||
switch (userConfigSwitch.getIdcardOcrProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.idOCR(idocrdto);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
idocrPo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)),IDOCRPo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return idocrPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业执照OCR
|
||||
*
|
||||
* @param licenseOCRDTO
|
||||
* @return
|
||||
*/
|
||||
public SysLicensePo licenseOcr(LicenseOCRDTO licenseOCRDTO) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getBusinessOcrSwitch() == 2) {
|
||||
return new SysLicensePo();
|
||||
}
|
||||
SysLicensePo sysLicensePo = new SysLicensePo();
|
||||
switch (userConfigSwitch.getBusinessOcrProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.license(licenseOCRDTO);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
sysLicensePo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)),SysLicensePo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return sysLicensePo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 驾驶证OCR
|
||||
*
|
||||
* @param drivinglicenceOCRDTO
|
||||
* @return
|
||||
*/
|
||||
public DrivinglicenceOCRPo drivingOcr(DrivinglicenceOCRDTO drivinglicenceOCRDTO) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getDriversOcrSwitch() == 2) {
|
||||
return new DrivinglicenceOCRPo();
|
||||
}
|
||||
DrivinglicenceOCRPo drivinglicenceOCRPo = new DrivinglicenceOCRPo();
|
||||
switch (userConfigSwitch.getDriversOcrProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.drivinglicence(drivinglicenceOCRDTO);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
drivinglicenceOCRPo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)),DrivinglicenceOCRPo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return drivinglicenceOCRPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 行驶证OCR
|
||||
*
|
||||
* @param drivingPermitOCRDTO
|
||||
* @return
|
||||
*/
|
||||
public DrivingPermitPo drivingPermitOcr(DrivingPermitOCRDTO drivingPermitOCRDTO) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getDrivingOcrSwitch() == 2) {
|
||||
return new DrivingPermitPo();
|
||||
}
|
||||
DrivingPermitPo drivingPermitPo = new DrivingPermitPo();
|
||||
switch (userConfigSwitch.getDrivingOcrProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.drivingPermit(drivingPermitOCRDTO);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
drivingPermitPo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)),DrivingPermitPo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return drivingPermitPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 银行卡OCR
|
||||
*
|
||||
* @param bankCardOCRDTO
|
||||
* @return
|
||||
*/
|
||||
public BankCardPo BankCard(BankCardOCRDTO bankCardOCRDTO) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getBankCardOcrSwitch() == 2) {
|
||||
return new BankCardPo();
|
||||
}
|
||||
BankCardPo bankCardPo = new BankCardPo();
|
||||
switch (userConfigSwitch.getBankCardOcrProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.BankCard(bankCardOCRDTO);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
bankCardPo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)), BankCardPo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return bankCardPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸识别核身
|
||||
*
|
||||
* @param sysIDOCRDTO
|
||||
* @return
|
||||
*/
|
||||
public SysFacePo faceSwiping(SysIDOCRDTO sysIDOCRDTO) {
|
||||
//获取租户配置
|
||||
UserConfigSwitchPo userConfigSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (userConfigSwitch.getFaceRecognitionSwitch() == 2) {
|
||||
return new SysFacePo();
|
||||
}
|
||||
SysFacePo sysFacePo = new SysFacePo();
|
||||
switch (userConfigSwitch.getFaceRecognitionProvider()) {
|
||||
//E签宝
|
||||
case 1:
|
||||
AjaxResult result = thirdPartyServiceFeign.faceSwiping(sysIDOCRDTO);
|
||||
if (StringUtils.isNull(result) || StringUtils.isNull(result.get("data"))) {
|
||||
throw new ServiceException(result.get(AjaxResult.MSG_TAG).toString());
|
||||
}else {
|
||||
sysFacePo = JSON.parseObject(JSONObject.toJSONString(result.get(AjaxResult.DATA_TAG)),SysFacePo.class);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return sysFacePo;
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.mhd.user.domain.userAggregate.service.UserAddressDomainService;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserAddressPO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserAddressDO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址应用服务
|
||||
*
|
||||
* @author gen
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserAddressApplicationService {
|
||||
|
||||
private final UserAddressDomainService userAddressDomainService;
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户地址列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户地址列表
|
||||
*/
|
||||
public List<UserAddressPO> getUserAddressList(Long userId) {
|
||||
return userAddressDomainService.getAddressByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID获取默认地址或第一个地址
|
||||
* 用于订单创建页面获取地址信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 地址信息(不包含ID)
|
||||
*/
|
||||
public UserAddressPO getAddressForOrder(Long userId) {
|
||||
return userAddressDomainService.getDefaultOrFirstAddress(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户地址
|
||||
*
|
||||
* @param userAddressDO 用户地址信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean addUserAddress(UserAddressDO userAddressDO) {
|
||||
return userAddressDomainService.addUserAddress(userAddressDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户地址
|
||||
*
|
||||
* @param userAddressDO 用户地址信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean updateUserAddress(UserAddressDO userAddressDO) {
|
||||
return userAddressDomainService.updateUserAddress(userAddressDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户地址
|
||||
*
|
||||
* @param userAddressIds 地址ID数组
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean deleteUserAddress(Long[] userAddressIds) {
|
||||
return userAddressDomainService.deleteUserAddress(userAddressIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param addressId 地址ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean setDefaultAddress(Long userId, Long addressId) {
|
||||
// 验证地址是否属于该用户
|
||||
if (!userAddressDomainService.validateAddressBelongsToUser(userId, addressId)) {
|
||||
throw new RuntimeException("地址不属于该用户");
|
||||
}
|
||||
|
||||
return userAddressDomainService.setDefaultAddress(userId, addressId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地址详情
|
||||
*
|
||||
* @param addressId 地址ID
|
||||
* @return 地址详情
|
||||
*/
|
||||
public UserAddressPO getAddressInfo(Long addressId) {
|
||||
return userAddressDomainService.getAddressInfo(addressId);
|
||||
}
|
||||
}
|
||||
+4857
File diff suppressed because it is too large
Load Diff
+115
@@ -0,0 +1,115 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.google.common.base.Strings;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDataPermissionDO;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDataPermissionDomainService;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
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.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.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserDataPermissionApplicationService {
|
||||
@Resource
|
||||
private UserDataPermissionDomainService userDataPermissionDomainService;
|
||||
@Resource
|
||||
private ProductServiceFeign productServiceFeign;
|
||||
|
||||
/**
|
||||
* @Description 获取用户组织信息
|
||||
* @Author Alex
|
||||
* @Date 2023/1/11 18:48
|
||||
*/
|
||||
public UserDataPermissionQueryDTO getUserDataPermissionQueryDTO(UserDataPermissionQueryDTO userDataPermissionQueryDTO) {
|
||||
//获取登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long organizationId = new Long("2");
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
/*if (ObjectUtil.isNull(userDataPermissionQueryDTO.getPermissionMenuId())) {
|
||||
// TODO 前端菜单ID
|
||||
throw new ServiceException("请求异常");
|
||||
}*/
|
||||
|
||||
organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
//当前登录人不是超管时,
|
||||
if (!(Strings.isNullOrEmpty(loginUserPo.getRoleCode()))) {
|
||||
// 租户管理员查询时,先查询当前组织及组织下所有组织
|
||||
if (loginUserPo.getRoleCode().contains(RoleEnum.PLAT_ADMIN.getCode())) {
|
||||
AjaxResult ajaxResult = productServiceFeign.getOrganizationIdsByOrganizationId(organizationId);
|
||||
//先根据组织ID获取一级组织
|
||||
Object organizationIdList = ajaxResult.get("data");
|
||||
List<Long> organizationIds = new ArrayList<>();
|
||||
if (organizationIdList instanceof ArrayList<?>) {
|
||||
for (Object o : (List<?>) organizationIdList) {
|
||||
organizationIds.add(Long.valueOf(o.toString()));
|
||||
}
|
||||
}
|
||||
userDataPermissionQueryDTO.setPermissionOrganizationIds(organizationIds);
|
||||
}
|
||||
} else if(ObjectUtil.isNotNull(userDataPermissionQueryDTO.getPermissionMenuId())){
|
||||
UserDataPermissionDO userDataPermissionDO = new UserDataPermissionDO();
|
||||
userDataPermissionDO.setMenuId(userDataPermissionQueryDTO.getPermissionMenuId());
|
||||
userDataPermissionDO.setUserId(loginUserPo.getUserId());
|
||||
userDataPermissionDO.setOrganizationId(loginUserPo.getOrganizationId());
|
||||
//查询用户数据权限
|
||||
UserDataPermissionPO userDataPermissionPO = findUserDataPermission(userDataPermissionDO);
|
||||
//没有给用户设置数据权限,则查询个人创建数据
|
||||
if (ObjectUtil.isNull(userDataPermissionPO)) {
|
||||
userDataPermissionQueryDTO.setCreateBy(loginUserPo.getUserId());
|
||||
} else {
|
||||
//操作个人创建数据:0-无状态,1-允许,2-不允许
|
||||
Integer userDataPersonalStatus = userDataPermissionPO.getUserDataPersonalStatus();
|
||||
//操作组织所有数据:0-无状态,1-允许,2-不允许
|
||||
Integer userDataOrganizationStatus = userDataPermissionPO.getUserDataOrganizationStatus();
|
||||
if (userDataOrganizationStatus == 1) {
|
||||
AjaxResult ajaxResult = productServiceFeign.getOrganizationIdsByOrganizationId(loginUserPo.getOrganizationId());
|
||||
//先根据组织ID获取一级组织
|
||||
Object organizationIdList = ajaxResult.get("data");
|
||||
List<Long> organizationIds = new ArrayList<>();
|
||||
if (organizationIdList instanceof ArrayList<?>) {
|
||||
for (Object o : (List<?>) organizationIdList) {
|
||||
organizationIds.add(Long.valueOf(o.toString()));
|
||||
}
|
||||
}
|
||||
userDataPermissionQueryDTO.setPermissionOrganizationIds(organizationIds);
|
||||
} else {
|
||||
userDataPermissionQueryDTO.setCreateBy(loginUserPo.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return userDataPermissionQueryDTO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description 查询用户数据权限-单条
|
||||
* @Author Alex
|
||||
* @Date 2023/1/10 14:13
|
||||
*/
|
||||
public UserDataPermissionPO findUserDataPermission(UserDataPermissionDO userDataPermissionDO) {
|
||||
if (ObjectUtil.isNull(userDataPermissionDO.getUserId())
|
||||
|| ObjectUtil.isNull(userDataPermissionDO.getMenuId())
|
||||
|| ObjectUtil.isNull(userDataPermissionDO.getOrganizationId())) {
|
||||
throw new ServiceException("请传入用户,菜单,组织信息");
|
||||
}
|
||||
return userDataPermissionDomainService.findUserDataPermission(userDataPermissionDO);
|
||||
}
|
||||
}
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.UserRoleMenuPO;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.common.core.enums.RoleEnum;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
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.FinanceServiceFeign;
|
||||
import com.mhd.system.api.OrganizationServiceFeign;
|
||||
import com.mhd.system.api.TicketServiceFeign;
|
||||
import com.mhd.system.api.TransportFeign;
|
||||
import com.mhd.system.api.domain.finance.AccountCashWalletPo;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.api.service.webSocket.AsyncWebSocketApplicationService;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDomainService;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDriverDomainService;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeRecordDomainService;
|
||||
import com.mhd.user.domain.projectUser.service.ProjectUserDomainService;
|
||||
import com.mhd.user.domain.roleAggregate.service.RoleDomainService;
|
||||
import com.mhd.user.domain.roleAggregate.service.RoleMenuDomainService;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserEntity;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
|
||||
import com.mhd.user.domain.userAggregate.factory.UserFactory;
|
||||
import com.mhd.user.domain.userAggregate.repository.mapper.UserMapper;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO;
|
||||
import com.mhd.user.domain.userAggregate.service.*;
|
||||
import com.mhd.user.infrastructure.feign.ProductServiceFeign;
|
||||
import com.mhd.user.infrastructure.feign.SpecialLogisticsFeign;
|
||||
import com.mhd.user.infrastructure.feign.SystemServiceFeign;
|
||||
import com.mhd.user.infrastructure.util.menu.UserRoleMenuUtils;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class UserDeleteApplicationService { @Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private UserDomainService userDomainService;
|
||||
@Resource
|
||||
private UserDriverDomainService userDriverDomainService;
|
||||
@Autowired
|
||||
private DriverVehicleBindDomainService driverVehicleBindDomainService;
|
||||
@Autowired
|
||||
private MotorcadeDomainService motorcadeDomainService;
|
||||
@Resource
|
||||
private UserShipperDomainService userShipperDomainService;
|
||||
@Resource
|
||||
private UserRoleDomainService userRoleDomainService;
|
||||
@Resource
|
||||
private TransportFeign transportFeign;
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Resource
|
||||
private UserDriverEnterpriseApplicationService userDriverEnterpriseApplicationService;
|
||||
@Resource
|
||||
private MotorcadeDriverDomainService motorcadeDriverDomainService;
|
||||
@Resource
|
||||
private FinanceServiceFeign financeServiceFeign;
|
||||
@Resource
|
||||
private UserWlhyDomainService wlhyDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserMallDomainService userMallDomainService;
|
||||
|
||||
@Autowired
|
||||
private UserDriverEnterpriseDomainService userDriverEnterpriseDomainService;
|
||||
@Autowired
|
||||
private UserWlhyDomainService userWlhyDomainService;
|
||||
@Autowired
|
||||
private MotorcadeRecordDomainService motorcadeRecordDomainService;
|
||||
@Autowired
|
||||
private SpecialLogisticsFeign specialLogisticsFeign;
|
||||
|
||||
/**
|
||||
* 单个用户删除操作
|
||||
*/
|
||||
@GlobalTransactional(rollbackFor = Exception.class)
|
||||
public void deleteByUser(UserPo userPo){
|
||||
//获取当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo loginUserPo = loginUser.getUserPo();
|
||||
Integer deleteRole = userPo.getDeleteRole();
|
||||
if (deleteRole == null){
|
||||
throw new ServiceException("删除业务不明确!");
|
||||
}
|
||||
UserShipperEntity userShipperEntity = null;
|
||||
List<UserRoleMenuPO> newUserRoleMenuPOS = new ArrayList<>();
|
||||
//托运人
|
||||
if (deleteRole == 1 || deleteRole == 3 || deleteRole == 4){
|
||||
//查询货主信息
|
||||
userShipperEntity = userShipperDomainService.findShipperByUserId(userPo.getUserId());
|
||||
if (userShipperEntity != null){
|
||||
if (deleteRole == 4){
|
||||
//删除角色信息
|
||||
List<UserRoleMenuPO> userRoleMenuPOS = userRoleDomainService.selectRolesByUserId(userPo.getUserId());
|
||||
for (UserRoleMenuPO userRoleMenuPO : userRoleMenuPOS) {
|
||||
if (userRoleMenuPO.getRoleCode().equals(RoleEnum.SHIPPER.getCode()) || userRoleMenuPO.getRoleCode().equals(RoleEnum.COMPANY.getCode())){
|
||||
userRoleDomainService.deleteCodeByUserId(userPo.getUserId(), userRoleMenuPO.getRoleCode());
|
||||
}else {
|
||||
newUserRoleMenuPOS.add(userRoleMenuPO);
|
||||
}
|
||||
}
|
||||
userPo.setBusinessType(2);
|
||||
}
|
||||
|
||||
//查看是否存在企业员工
|
||||
if (userShipperEntity.getShipperType() == 2){
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserAccountType(5);
|
||||
userDO.setCreateBy(userPo.getUserId());
|
||||
List<UserPo> userPos = userDomainService.selectList(userDO);
|
||||
if (userPos != null && !userPos.isEmpty()){
|
||||
throw new ServiceException("当前企业还有企业员工未处理,请先删除企业员工;");
|
||||
}
|
||||
}
|
||||
userShipperEntity.setDelFlag(2);
|
||||
userShipperEntity.setUpdateBy(loginUserPo.getUserId());
|
||||
userShipperEntity.setUpdateByName(loginUserPo.getUserName());
|
||||
userShipperEntity.setUpdateTime(new Date());
|
||||
}
|
||||
}
|
||||
//承运人
|
||||
if (deleteRole == 2 || deleteRole == 3 || deleteRole == 5){
|
||||
//司机
|
||||
UserDriverPo userDriverPo = userDriverDomainService.findByUserId(userPo.getUserId());
|
||||
if (userDriverPo != null){
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
userDriverDO.setDriverId(userDriverPo.getDriverId());
|
||||
userDriverDO.setDelFlag(2);
|
||||
userDriverDO.setUpdateByName(loginUserPo.getUserName());
|
||||
userDriverDO.setUpdateBy(loginUserPo.getUserId());
|
||||
userDriverDO.setUpdateTime(new Date());
|
||||
userDriverDomainService.saveUserDriver(userDriverDO);
|
||||
}
|
||||
//车队长/承运企业
|
||||
UserDriverEnterprisePo userDriverEnterprisePo = userDriverEnterpriseDomainService.getInfoByUserId(userPo.getUserId());
|
||||
if (userDriverEnterprisePo != null){
|
||||
UserDriverEnterpriseDo userDriverEnterpriseDo = new UserDriverEnterpriseDo();
|
||||
userDriverEnterpriseDo.setUserDriverEnterpriseId(userDriverEnterprisePo.getUserDriverEnterpriseId());
|
||||
userDriverEnterpriseDo.setDelFlag(2);
|
||||
userDriverEnterpriseDo.setUpdateByName(loginUserPo.getUserName());
|
||||
userDriverEnterpriseDo.setUpdateBy(loginUserPo.getUserId());
|
||||
userDriverEnterpriseDo.setUpdateTime(new Date());
|
||||
userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
}
|
||||
UserDriverEnterprisePo captainInfo = userDriverEnterpriseDomainService.getCaptainInfoByUserId(userPo.getUserId());
|
||||
if (captainInfo != null){
|
||||
UserDriverEnterpriseDo userDriverEnterpriseDo = new UserDriverEnterpriseDo();
|
||||
userDriverEnterpriseDo.setUserDriverEnterpriseId(captainInfo.getUserDriverEnterpriseId());
|
||||
userDriverEnterpriseDo.setDelFlag(2);
|
||||
userDriverEnterpriseDo.setUpdateByName(loginUserPo.getUserName());
|
||||
userDriverEnterpriseDo.setUpdateBy(loginUserPo.getUserId());
|
||||
userDriverEnterpriseDo.setUpdateTime(new Date());
|
||||
userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
}
|
||||
|
||||
//判断是否有自己创建的车辆和绑定的车辆
|
||||
if (driverVehicleBindDomainService.selectByUserId(userPo.getUserId()) > 0){
|
||||
throw new ServiceException("存在创建/绑定的车辆,请先删除/解绑车辆;");
|
||||
}
|
||||
//判断自己创建的车辆
|
||||
List<VehiclePo> vehiclePoList = new ArrayList<>();
|
||||
R<List<VehiclePo>> vehicle = transportFeign.getVehiclePosByUserId(userPo.getUserId());
|
||||
if (R.SUCCESS == vehicle.getCode()){
|
||||
//查询成功,取值
|
||||
vehiclePoList = vehicle.getData();
|
||||
}
|
||||
if (vehiclePoList != null && !vehiclePoList.isEmpty()){
|
||||
throw new ServiceException("存在创建的车辆,请先删除车辆;");
|
||||
}
|
||||
|
||||
//判断车队是否解散
|
||||
List<Long> longs1 = motorcadeDriverDomainService.selectMotorcadeIdByUserId(userPo.getUserId());
|
||||
if (longs1 != null && !longs1.isEmpty()){
|
||||
throw new ServiceException("当前还有车队未解散,请先解散车队;");
|
||||
}
|
||||
//判断是否存在车队邀请记录
|
||||
List<MotorcadeRecord> moList = motorcadeRecordDomainService.getByMotorHeaderId(userPo.getUserId());
|
||||
if (moList != null && !moList.isEmpty()){
|
||||
moList.forEach(e->e.setDelFlag(2));
|
||||
motorcadeRecordDomainService.updateBatchById(moList);
|
||||
}
|
||||
|
||||
|
||||
//判断是否加入车队
|
||||
List<Long> longs2 = motorcadeDomainService.selectMotorcadeIdList(userPo.getUserId());
|
||||
if (longs2 != null && !longs2.isEmpty()){
|
||||
throw new ServiceException("您已加入车队,请先退出车队;");
|
||||
}
|
||||
//判断自己创建的司机
|
||||
List<Long> inDriverIdList = userDriverEnterpriseApplicationService.selectUserIdListByUserId(userPo.getUserId());
|
||||
if (inDriverIdList != null && !inDriverIdList.isEmpty()){
|
||||
throw new ServiceException("您存在自有司机未删除,请先进行删除;");
|
||||
}
|
||||
if (userDomainService.selectCreatByUserId(userPo.getUserId()) > 0){
|
||||
throw new ServiceException("您存在自有司机未删除,请先进行删除;");
|
||||
}
|
||||
|
||||
if (deleteRole == 5){
|
||||
//删除角色信息
|
||||
List<UserRoleMenuPO> userRoleMenuPOS = userRoleDomainService.selectRolesByUserId(userPo.getUserId());
|
||||
for (UserRoleMenuPO userRoleMenuPO : userRoleMenuPOS) {
|
||||
if (userRoleMenuPO.getRoleCode().equals(RoleEnum.DRIVER.getCode()) || userRoleMenuPO.getRoleCode().equals(RoleEnum.CAPTAIN.getCode()) || userRoleMenuPO.getRoleCode().equals(RoleEnum.CARRIER.getCode())){
|
||||
userRoleDomainService.deleteCodeByUserId(userPo.getUserId(), userRoleMenuPO.getRoleCode());
|
||||
}else {
|
||||
newUserRoleMenuPOS.add(userRoleMenuPO);
|
||||
}
|
||||
}
|
||||
userPo.setBusinessType(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (deleteRole == 1 || deleteRole == 2 || deleteRole == 3){
|
||||
//钱包信息
|
||||
R<AccountCashWalletPo> accountCashWalletPoR = financeServiceFeign.getWalletByUserId(userPo.getUserId());
|
||||
if (R.SUCCESS == accountCashWalletPoR.getCode()) {
|
||||
AccountCashWalletPo cashWalletPo = accountCashWalletPoR.getData();
|
||||
if(cashWalletPo != null && cashWalletPo.getAccountCashWalletId() != null){
|
||||
if (cashWalletPo.getWalletBalance().compareTo(BigDecimal.ZERO) > 0){
|
||||
throw new ServiceException("钱包余额不为0,请先处理;");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deleteRole == 1 || deleteRole == 2 || deleteRole == 3){
|
||||
//删除三方账号
|
||||
deleteAccount(userPo.getUserId());
|
||||
}
|
||||
|
||||
|
||||
//同步网货
|
||||
userWlhyDomainService.removeDriverOrShipper(userPo);
|
||||
if (deleteRole == 1 || deleteRole == 2 || deleteRole == 3){
|
||||
//钱包信息
|
||||
R<AccountCashWalletPo> accountCashWalletPoR = financeServiceFeign.getWalletByUserId(userPo.getUserId());
|
||||
if (R.SUCCESS == accountCashWalletPoR.getCode()) {
|
||||
AccountCashWalletPo cashWalletPo = accountCashWalletPoR.getData();
|
||||
if(cashWalletPo != null && cashWalletPo.getAccountCashWalletId() != null){
|
||||
financeServiceFeign.deleteCashWalletById(cashWalletPo.getAccountCashWalletId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//同步商城信息
|
||||
UserEntity userEntity = new UserEntity();
|
||||
BeanUtils.copyProperties(userPo, userEntity);
|
||||
userEntity.setDelFlag(2);
|
||||
userMallDomainService.syncDriverUserInfo(userEntity);
|
||||
|
||||
if (deleteRole == 4){
|
||||
//三方账号
|
||||
if (userShipperEntity != null && StringUtils.isNotBlank(userShipperEntity.getShipperEnterpriseName()) && StringUtils.isNotBlank(userShipperEntity.getCompanyAccountId())) {
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.deleteAccount(userShipperEntity.getCompanyAccountId());
|
||||
if ("200".equals(ajaxResult.get("code").toString())) {
|
||||
UserShipperDO userShipperDO = new UserShipperDO();
|
||||
userShipperDO.setShipperId(userShipperEntity.getShipperId());
|
||||
userShipperDO.setCompanyAccountId("");
|
||||
userShipperDO.setCompanyTemplateSeal("");
|
||||
userPo.setCompanyAccountId("");
|
||||
userPo.setCompanyTemplateSeal("");
|
||||
} else {
|
||||
throw new ServiceException(ajaxResult.get("msg").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userShipperEntity != null){
|
||||
userShipperDomainService.updateById(userShipperEntity);
|
||||
}
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(userPo, userDO);
|
||||
if (deleteRole == 1 || deleteRole == 2 || deleteRole == 3){
|
||||
userDO.setDelFlag(2);
|
||||
}
|
||||
if (!newUserRoleMenuPOS.isEmpty()){
|
||||
userDO.setRoleCode(newUserRoleMenuPOS.stream().map(UserRoleMenuPO::getRoleCode).collect(Collectors.joining(",")));
|
||||
userDO.setRoleName(newUserRoleMenuPOS.stream().map(UserRoleMenuPO::getRoleName).collect(Collectors.joining(",")));
|
||||
}
|
||||
userDO.setUpdateBy(loginUserPo.getUserId());
|
||||
userDO.setUpdateByName(loginUserPo.getUserName());
|
||||
userDomainService.updateUser(userDO);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销e签宝签署账户
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
public void deleteAccount(Long userId) {
|
||||
//获取user对象
|
||||
UserPo userPo = userDomainService.selectByUserId(userId);
|
||||
if (null == userPo) {
|
||||
throw new ServiceException("未查询到该用户信息");
|
||||
}
|
||||
if (StringUtils.isNotBlank(userPo.getAccountId())) {
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.deleteAccount(userPo.getAccountId());
|
||||
if ("200".equals(ajaxResult.get("code").toString())) {
|
||||
userPo.setAccountId("");
|
||||
userPo.setUserTemplateSeal("");
|
||||
userPo.setUserTemplateSealStatus(2);
|
||||
} else {
|
||||
throw new ServiceException(ajaxResult.get("msg").toString());
|
||||
}
|
||||
}
|
||||
if (userPo.getUserTemplateSealStatus() == 2){
|
||||
//判断是否有企业货主
|
||||
UserShipperPo userShipperPo = userShipperDomainService.selectByUserId(userId);
|
||||
if (userShipperPo != null && StringUtils.isNotBlank(userShipperPo.getShipperEnterpriseName()) && StringUtils.isNotBlank(userShipperPo.getCompanyAccountId())) {
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.deleteAccount(userShipperPo.getCompanyAccountId());
|
||||
if ("200".equals(ajaxResult.get("code").toString())) {
|
||||
UserShipperDO userShipperDO = new UserShipperDO();
|
||||
userShipperDO.setShipperId(userShipperPo.getShipperId());
|
||||
userShipperDO.setCompanyAccountId("");
|
||||
userShipperDO.setCompanyTemplateSeal("");
|
||||
userPo.setCompanyAccountId("");
|
||||
userPo.setCompanyTemplateSeal("");
|
||||
userShipperDomainService.saveUserShipper(userShipperDO);
|
||||
} else {
|
||||
throw new ServiceException(ajaxResult.get("msg").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存到数据库中
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserId(userId);
|
||||
userDO.setAccountId(userPo.getAccountId());
|
||||
userDO.setUserTemplateSeal(userPo.getUserTemplateSeal());
|
||||
userDO.setUserTemplateSealStatus(2);
|
||||
userDomainService.updateUser(userDO);
|
||||
|
||||
wlhyDomainService.synTemplateSeal(userPo);
|
||||
}
|
||||
}
|
||||
+2722
File diff suppressed because it is too large
Load Diff
+775
@@ -0,0 +1,775 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.base.Strings;
|
||||
import com.mhd.common.core.domain.dto.SysProvinceCityCountyDTO;
|
||||
import com.mhd.common.core.domain.dto.WebSocketDTO;
|
||||
import com.mhd.common.core.domain.dto.open.OpenDriverDto;
|
||||
import com.mhd.common.core.domain.po.SysAreaPO;
|
||||
import com.mhd.common.core.domain.thirdparty.EnterpriseRoadLicenseDTO;
|
||||
import com.mhd.common.core.enums.DictCode;
|
||||
import com.mhd.common.core.enums.WebsocketTypeEnum;
|
||||
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.service.webSocket.AsyncWebSocketApplicationService;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.service.MotorcadeDomainService;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserDriverEnterprise;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserEntity;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverEnterprisePo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverEnterpriseDo;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserDriverEnterpriseDomainService;
|
||||
import com.mhd.user.domain.userAggregate.service.UserWlhyDomainService;
|
||||
import com.mhd.user.infrastructure.feign.SystemServiceFeign;
|
||||
import com.mhd.user.infrastructure.feign.vo.SysDictDataVo;
|
||||
import com.mhd.user.infrastructure.util.annotation.DataPermissions;
|
||||
import com.mhd.user.interfaces.assember.UserDriverEnterpriseAssembler;
|
||||
import com.mhd.common.core.domain.po.UserConfigSwitchPo;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
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.IgnoreNullUtil;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValueField;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValueMethod;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.interfaces.constants.UserDriverConstants;
|
||||
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 javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 运输企业ApplicationService
|
||||
*
|
||||
* @author ???
|
||||
* @date 2023-05-17
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserDriverEnterpriseApplicationService {
|
||||
@Autowired
|
||||
private UserDriverEnterpriseDomainService userDriverEnterpriseDomainService;
|
||||
@Resource
|
||||
private CommonApplicationService commonApplicationService;
|
||||
|
||||
@Resource
|
||||
private UserApplicationService userApplicationService;
|
||||
|
||||
@Resource
|
||||
private UserDriverApplicationService userDriverApplicationService;
|
||||
|
||||
@Resource
|
||||
private UserWlhyDomainService wlhyDomainService;
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
@Resource
|
||||
private OpenTmsUserApplicationService openTmsUserApplicationService;
|
||||
|
||||
@Autowired
|
||||
private UserDomainService userDomainService;
|
||||
|
||||
@Autowired
|
||||
private AsyncWebSocketApplicationService asyncWebSocketApplicationService;
|
||||
|
||||
@Resource
|
||||
private ThirdPartyServiceFeign thirdPartyServiceFeign;
|
||||
@Resource
|
||||
private MotorcadeDomainService motorcadeDomainService;
|
||||
|
||||
@Resource
|
||||
private MotorcadeApplicationService motorcadeApplicationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询运输企业列表
|
||||
*/
|
||||
|
||||
@DataPermissions(cacheName = "master")
|
||||
public List<UserDriverEnterprisePo> queryList(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
/* if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
userDriverEnterpriseDo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}*/
|
||||
return userDriverEnterpriseDomainService.queryList(userDriverEnterpriseDo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增运输企业
|
||||
*/
|
||||
public Boolean insert(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
|
||||
return userDriverEnterpriseDomainService.insert(userDriverEnterpriseDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运输企业
|
||||
*/
|
||||
public Boolean update(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
return userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除运输企业
|
||||
*/
|
||||
public Boolean delete(Long[] userDriverEnterpriseIds) {
|
||||
return userDriverEnterpriseDomainService.delete(userDriverEnterpriseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运输企业详细信息
|
||||
*/
|
||||
public UserDriverEnterprisePo getInfo(Long userDriverEnterpriseId) {
|
||||
return userDriverEnterpriseDomainService.getInfo(userDriverEnterpriseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取运输企业信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@NeedSetValueMethod
|
||||
public UserDriverEnterprisePo getInfoByUserId(Long userId) {
|
||||
return userDriverEnterpriseDomainService.getInfoByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取运输企业信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@NeedSetValueMethod
|
||||
public UserDriverEnterprisePo getInfoByUserId1(Long userId) {
|
||||
return userDriverEnterpriseDomainService.getInfoByUserId1(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运输企业认证
|
||||
*
|
||||
* @param userDriverEnterpriseDo
|
||||
* @return
|
||||
*/
|
||||
public Boolean userEnterpriseAuth(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
/*
|
||||
* 根据登录人查询是否进行了已插入企业信息,如果插入了则进行更新,如果没有,则新增
|
||||
*/
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户的开关配置信息
|
||||
UserConfigSwitchPo userConfigSwitchPo = commonApplicationService.getUserConfigSwitch();
|
||||
if (null == userConfigSwitchPo) {
|
||||
throw new ServiceException("平台租户开关配置未找到");
|
||||
}
|
||||
UserDriverEnterprise userDriverEnterprise = new UserDriverEnterprise();
|
||||
//查询是否有旧的数据(没有说明是第一次认证,需要将对应的个人认证信息填写到法人信息中)
|
||||
//装配
|
||||
userDriverEnterprise = new UserDriverEnterpriseAssembler().toDo(userDriverEnterpriseDo);
|
||||
userDriverEnterprise.setUserId(loginUser.getUserid());
|
||||
userDriverEnterprise.setDriverType(1);
|
||||
UserDriverEnterprisePo userDriverEnterprisePo = userDriverEnterpriseDomainService.getInfoByUserId(loginUser.getUserid());
|
||||
if (null != userDriverEnterprisePo) {
|
||||
userDriverEnterprise.setUserDriverEnterpriseId(userDriverEnterprisePo.getUserDriverEnterpriseId());
|
||||
}
|
||||
UserPo userPo = userApplicationService.selectByUserId(loginUser.getUserid());
|
||||
if (userPo != null && (userPo.getBusinessType() == 1 || userPo.getBusinessType() == 3)) {
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserId(userPo.getUserId());
|
||||
userDO.setBusinessType(3);
|
||||
userApplicationService.updateById(userDO);
|
||||
}
|
||||
|
||||
if (userDriverEnterpriseDo.getStepFlag() != null && userDriverEnterpriseDo.getStepFlag() == 1) {
|
||||
//认证第一步:营业执照认证
|
||||
//判断营业执照核验是否开启:开启-进行核验,关闭,只保存数据,
|
||||
if (userConfigSwitchPo.getBusinessVerificationSwitch() == 1) {
|
||||
//TODO 调用三方进行核验
|
||||
|
||||
}
|
||||
//没传信息默认居民身份证
|
||||
if (StrUtil.isNotEmpty(userDriverEnterpriseDo.getLegalPersonIdType())) {
|
||||
AjaxResult idTypeDictResult = systemServiceFeign.selectListByDictType(DictCode.ID_TYPE.getCode());
|
||||
if (!"200".equals(String.valueOf(idTypeDictResult.get("code")))) {
|
||||
throw new ServiceException("证件类型数据字典不存在");
|
||||
}
|
||||
List<SysDictDataVo> idTypeDictDataVoList = JSON.parseArray(JSONUtil.toJsonStr(idTypeDictResult.get("data")), SysDictDataVo.class);
|
||||
SysDictDataVo idTypeDictDataVo = idTypeDictDataVoList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), userDriverEnterpriseDo.getLegalPersonIdType())).findAny().orElse(null);
|
||||
if (null == idTypeDictDataVo) {
|
||||
throw new ServiceException("证件类型【" + userDriverEnterpriseDo.getLegalPersonIdType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
userDriverEnterprise.setLegalPersonIdName(idTypeDictDataVo.getDictLabel());
|
||||
} else {
|
||||
userDriverEnterprise.setLegalPersonIdType("10");
|
||||
userDriverEnterprise.setLegalPersonIdName("201_居民身份证");
|
||||
}
|
||||
|
||||
//承运商编码 - 取用户账号
|
||||
String code = loginUser.getUserPo().getUserAccount();
|
||||
userDriverEnterprise.setDriverEnterpriseCode(code);
|
||||
//保存法人信息
|
||||
userDriverEnterprise.setDriverCorp(1L);
|
||||
userDriverEnterprise.setDriverCorpName(userPo.getUserName());
|
||||
userDriverEnterprise.setDriverCorpLegalName(userPo.getUserName());
|
||||
userDriverEnterprise.setDriverCorpIdcardNumber(userPo.getUserIdcardNumber());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if (StringUtils.isNotBlank(userPo.getUserIdcardDateFrom())) {
|
||||
try {
|
||||
userDriverEnterprise.setDriverCorpIdcardDateFrom(sdf.parse(userPo.getUserIdcardDateFrom()));
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(userPo.getUserIdcardDateTo())) {
|
||||
try {
|
||||
userDriverEnterprise.setDriverCorpIdcardDateTo(sdf.parse(userPo.getUserIdcardDateTo()));
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
}
|
||||
userDriverEnterprise.setDriverCorpIdcardLong(userPo.getUserIdcardLong());
|
||||
userDriverEnterprise.setDriverCorpIdcardFrontUrl(userPo.getUserIdcardFrontUrl());
|
||||
userDriverEnterprise.setDriverCorpIdcardBackUrl(userPo.getUserIdcardBackUrl());
|
||||
userDriverEnterprise.setDriverCorpIdcardInhandUrl(userPo.getUserIdcardInhandUrl());
|
||||
|
||||
//同步网货使用
|
||||
UserDriverEnterpriseDo userDriverEnterpriseDo1 = new UserDriverEnterpriseDo();
|
||||
BeanUtils.copyProperties(userDriverEnterprise, userDriverEnterpriseDo1);
|
||||
userDriverEnterpriseDo1.setDriverType(2);
|
||||
userDriverEnterpriseDo1.setUserName(userPo.getUserName());
|
||||
userDriverEnterpriseDo1.setUserPhone(userPo.getUserPhone());
|
||||
userDriverEnterpriseDo1.setUserIdcardNumber(userDriverEnterprise.getDriverCorpIdcardNumber());
|
||||
userDriverEnterpriseDo1.setUserIdcardFrontUrl(userDriverEnterprise.getDriverCorpIdcardFrontUrl());
|
||||
userDriverEnterpriseDo1.setUserIdcardBackUrl(userDriverEnterprise.getDriverCorpIdcardBackUrl());
|
||||
userDriverEnterpriseDo1.setUserIdcardDateFrom(userDriverEnterprise.getDriverCorpIdcardDateFrom());
|
||||
userDriverEnterpriseDo1.setUserIdcardLong(userDriverEnterprise.getDriverCorpIdcardLong());
|
||||
userDriverEnterpriseDo1.setUserIdcardDateTo(userDriverEnterprise.getDriverCorpIdcardDateTo());
|
||||
userDriverEnterpriseDo1.setCarrierType(2);
|
||||
userDriverEnterpriseDo1.setEnterpriseUserId(userPo.getUserId());
|
||||
wlhyDomainService.saveOrUpdateCarrierInfo(userDriverEnterpriseDo1);
|
||||
|
||||
} else if (userDriverEnterpriseDo.getStepFlag() != null && userDriverEnterpriseDo.getStepFlag() == 2) {
|
||||
//认证第二部:道路运输经营许可证
|
||||
//判断道路运输经营许可证是否开启: 开启-进行核验,关闭,将状态修改到 2-审核中
|
||||
if (userConfigSwitchPo.getRoadTransportVerification() == 1 && StringUtils.isNotBlank(userDriverEnterpriseDo.getDriverBusinessLicenseNumber())
|
||||
&& StringUtils.isNotBlank(userDriverEnterpriseDo.getDriverBusinessLicenseOwner())) {
|
||||
// 验证企业道路运输经营许可证
|
||||
EnterpriseRoadLicenseDTO enterpriseRoadLicenseDTO = new EnterpriseRoadLicenseDTO();
|
||||
enterpriseRoadLicenseDTO.setComp(userDriverEnterpriseDo.getDriverBusinessLicenseNumber());
|
||||
enterpriseRoadLicenseDTO.setCorpRoadTransport(userDriverEnterpriseDo.getDriverBusinessLicenseOwner());
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.enterpriseRoadLicenseV3(enterpriseRoadLicenseDTO);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("验证企业道路运输经营许可证失败");
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
com.alibaba.fastjson2.JSONObject resultJson = jsonObject.getJSONObject("result");
|
||||
String licenseCodeIsEquals = resultJson.getString("licenseCodeIsEquals");//0- 不一致;1-一致
|
||||
if (!"1".equals(licenseCodeIsEquals)) {
|
||||
throw new ServiceException("验证企业道路运输经营许可证号不匹配");
|
||||
}
|
||||
} else {
|
||||
userDriverEnterprise.setDriverEnterpriseFill(2);
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException("步骤类型错误");
|
||||
}
|
||||
Boolean flag = userDriverEnterpriseDomainService.saveOrUpdate(userDriverEnterprise);
|
||||
|
||||
if (userDriverEnterpriseDo.getStepFlag() == 2) {
|
||||
//自动审核用户信息
|
||||
if (ObjectUtil.equal(userConfigSwitchPo.getAutomaticCheckUserInfo(), 1)) {
|
||||
UserDriverDO authDriver = new UserDriverDO();
|
||||
authDriver.setAutomaticCheckUserInfo(1);
|
||||
authDriver.setAuthType(3);
|
||||
authDriver.setDriverAuthStatus(3);
|
||||
authDriver.setUserId(loginUser.getUserid());
|
||||
userDriverApplicationService.authDriver(authDriver);
|
||||
} else {
|
||||
//提交认证、提送通知消息
|
||||
driverPendingReviewPush(loginUser);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 承运企业认证
|
||||
*
|
||||
* @param userDriverEnterpriseDo
|
||||
* @return
|
||||
*/
|
||||
@NeedSetValueField
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> companyAuth(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 1. 初始化和确定业务类型
|
||||
initializeBusinessType(userDriverEnterpriseDo);
|
||||
|
||||
// 刷新时间戳相关字段 (保持原有逻辑)
|
||||
refreshDateLong(userDriverEnterpriseDo);
|
||||
|
||||
// 2. 用户注册或更新
|
||||
// 如果 userId 为空,表示是新用户注册;否则,更新用户信息
|
||||
if (ObjectUtil.isNull(userDriverEnterpriseDo.getUserId())) {
|
||||
UserPo newUser = registerUser(userDriverEnterpriseDo);
|
||||
userDriverEnterpriseDo.setUserId(newUser.getUserId());
|
||||
result.put("userId", newUser.getUserId());
|
||||
} else {
|
||||
updateUserInformation(userDriverEnterpriseDo);
|
||||
result.put("userId", userDriverEnterpriseDo.getUserId()); // 确保userId在result中
|
||||
}
|
||||
|
||||
// 3. 处理法人证件类型
|
||||
setLegalPersonIdDetails(userDriverEnterpriseDo);
|
||||
|
||||
// 4. 保存或更新承运商基础信息 (wlhyDomainService)
|
||||
// 注意:原逻辑中 driverType 先设置为2再设置为1,这里需要确认业务含义
|
||||
// 此处遵循原逻辑中为 wlhyDomainService 设置 DRIVER_TYPE_CAPTAIN
|
||||
userDriverEnterpriseDo.setDriverType(UserDriverConstants.DRIVER_TYPE_CAPTAIN);
|
||||
userDriverEnterpriseDo.setCarrierType(UserDriverConstants.CARRIER_TYPE_ENTERPRISE); // 假设 2 代表企业
|
||||
userDriverEnterpriseDo.setEnterpriseUserId(userDriverEnterpriseDo.getUserId());
|
||||
userDriverEnterpriseDo.setDriverEnterpriseCode(userDriverEnterpriseDo.getUserAccount()); // 承运商编码 - 取用户账号
|
||||
|
||||
// 同步原step1中将 driverCorp 相关信息复制到 userDriverEnterpriseDo 的 user 身份证相关字段
|
||||
syncDriverCorpToUserIdentity(userDriverEnterpriseDo);
|
||||
|
||||
wlhyDomainService.saveOrUpdateCarrierInfo(userDriverEnterpriseDo);
|
||||
|
||||
// 5. 保存或更新企业认证详细信息 (userDriverEnterpriseDomainService)
|
||||
// 此处遵循原逻辑中为 userDriverEnterpriseDomainService 设置 DRIVER_TYPE_ENTERPRISE
|
||||
userDriverEnterpriseDo.setDriverType(UserDriverConstants.DRIVER_TYPE_ENTERPRISE);
|
||||
if (ObjectUtil.isNull(userDriverEnterpriseDo.getUserDriverEnterpriseId())) {
|
||||
userDriverEnterpriseDomainService.insert(userDriverEnterpriseDo);
|
||||
} else {
|
||||
userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
}
|
||||
result.put("userDriverEnterpriseId", userDriverEnterpriseDo.getUserDriverEnterpriseId());
|
||||
|
||||
// 6. 企业资质验证与状态更新
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (ObjectUtil.isNull(configSwitch)) {
|
||||
throw new ServiceException("获取组织配置失败");
|
||||
}
|
||||
|
||||
userDriverEnterpriseDo.setDriverEnterpriseFill(UserDriverConstants.DRIVER_FILL_COMPLETED);
|
||||
|
||||
// 验证企业道路运输经营许可证
|
||||
//validateEnterpriseRoadLicense(userDriverEnterpriseDo, configSwitch);
|
||||
|
||||
// 再次更新企业信息,主要是更新认证状态等
|
||||
userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
|
||||
// 7. 处理审核流程
|
||||
processAuditAndNotifications(userDriverEnterpriseDo, configSwitch, loginUser);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void initializeBusinessType(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
// 默认为承运业务
|
||||
userDriverEnterpriseDo.setBusinessType(UserDriverConstants.BUSINESS_TYPE_DRIVER);
|
||||
if (userDriverEnterpriseDo.getUserId() != null) {
|
||||
UserPo userPo = userApplicationService.selectByUserId(userDriverEnterpriseDo.getUserId());
|
||||
if (userPo != null &&
|
||||
(userPo.getBusinessType() == UserDriverConstants.BUSINESS_TYPE_CUSTOMER ||
|
||||
userPo.getBusinessType() == UserDriverConstants.BUSINESS_TYPE_CUSTOMER_AND_DRIVER)) {
|
||||
userDriverEnterpriseDo.setBusinessType(UserDriverConstants.BUSINESS_TYPE_CUSTOMER_AND_DRIVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private UserPo registerUser(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
if (StrUtil.isBlank(userDriverEnterpriseDo.getUserAccount())) {
|
||||
throw new ServiceException("用户账号不能为空");
|
||||
}
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setAvatar(userDriverEnterpriseDo.getAvatar());
|
||||
userDO.setUserAccount(userDriverEnterpriseDo.getUserAccount());
|
||||
userDO.setUserName(userDriverEnterpriseDo.getUserName()); // 企业认证时,此userName可能是企业名或法人名,需确认
|
||||
userDO.setBusinessType(userDriverEnterpriseDo.getBusinessType());
|
||||
userDO.setUserPhone(userDriverEnterpriseDo.getUserAccount()); // 通常手机号作为账号
|
||||
return userApplicationService.addUser(userDO);
|
||||
}
|
||||
|
||||
private void updateUserInformation(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
if (ObjectUtil.isNull(userDriverEnterpriseDo.getUserId())) {
|
||||
throw new DigitalLogisticsException(UserError.USER_NULL, "用户ID不能为空");
|
||||
}
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserId(userDriverEnterpriseDo.getUserId());
|
||||
// 更新用户表中的法人身份证信息
|
||||
userDO.setUserIdcardBackUrl(userDriverEnterpriseDo.getDriverCorpIdcardBackUrl());
|
||||
userDO.setUserIdcardFrontUrl(userDriverEnterpriseDo.getDriverCorpIdcardFrontUrl());
|
||||
userDO.setUserIdcardInhandUrl(userDriverEnterpriseDo.getDriverCorpIdcardInhandUrl());
|
||||
userDO.setUserName(userDriverEnterpriseDo.getDriverCorpName()); // 更新用户表姓名为法人姓名
|
||||
userDO.setUserIdcardNumber(userDriverEnterpriseDo.getDriverCorpIdcardNumber());
|
||||
userDO.setUserIdcardLong(userDriverEnterpriseDo.getDriverCorpIdcardLong()); // 注意类型匹配 Integer vs Long
|
||||
userDO.setUserIdcardDateFrom(userDriverEnterpriseDo.getDriverCorpIdcardDateFrom());
|
||||
userDO.setUserIdcardDateTo(userDriverEnterpriseDo.getDriverCorpIdcardDateTo());
|
||||
// 如果有头像、业务类型等也在此处更新
|
||||
if (StrUtil.isNotBlank(userDriverEnterpriseDo.getAvatar())) {
|
||||
userDO.setAvatar(userDriverEnterpriseDo.getAvatar());
|
||||
}
|
||||
userDO.setBusinessType(userDriverEnterpriseDo.getBusinessType());
|
||||
|
||||
userApplicationService.updateUser(userDO);
|
||||
}
|
||||
|
||||
private void setLegalPersonIdDetails(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
if (StrUtil.isNotEmpty(userDriverEnterpriseDo.getLegalPersonIdType())) {
|
||||
AjaxResult idTypeDictResult = systemServiceFeign.selectListByDictType(DictCode.ID_TYPE.getCode());
|
||||
if (!UserDriverConstants.DICT_CODE_SUCCESS.equals(String.valueOf(idTypeDictResult.get(UserDriverConstants.DICT_KEY_CODE)))) {
|
||||
throw new ServiceException("证件类型数据字典不存在");
|
||||
}
|
||||
List<SysDictDataVo> idTypeDictDataVoList = JSON.parseArray(JSONUtil.toJsonStr(idTypeDictResult.get(UserDriverConstants.DICT_KEY_DATA)), SysDictDataVo.class);
|
||||
SysDictDataVo idTypeDictDataVo = idTypeDictDataVoList.stream()
|
||||
.filter(info -> ObjectUtil.equal(info.getDictValue(), userDriverEnterpriseDo.getLegalPersonIdType()))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (null == idTypeDictDataVo) {
|
||||
throw new ServiceException("证件类型【" + userDriverEnterpriseDo.getLegalPersonIdType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
userDriverEnterpriseDo.setLegalPersonIdName(idTypeDictDataVo.getDictLabel());
|
||||
} else {
|
||||
userDriverEnterpriseDo.setLegalPersonIdType(UserDriverConstants.DEFAULT_LEGAL_PERSON_ID_TYPE);
|
||||
userDriverEnterpriseDo.setLegalPersonIdName(UserDriverConstants.DEFAULT_LEGAL_PERSON_ID_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
private void syncDriverCorpToUserIdentity(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
// 这些字段在原 stepFlagE == 1 时被设置用于 saveOrUpdateCarrierInfo
|
||||
// 确保它们在 UserDriverEnterpriseDo 中被正确填充,以便 wlhyDomainService 使用
|
||||
userDriverEnterpriseDo.setUserIdcardNumber(userDriverEnterpriseDo.getDriverCorpIdcardNumber());
|
||||
userDriverEnterpriseDo.setUserIdcardFrontUrl(userDriverEnterpriseDo.getDriverCorpIdcardFrontUrl());
|
||||
userDriverEnterpriseDo.setUserIdcardBackUrl(userDriverEnterpriseDo.getDriverCorpIdcardBackUrl());
|
||||
userDriverEnterpriseDo.setUserIdcardDateFrom(userDriverEnterpriseDo.getDriverCorpIdcardDateFrom());
|
||||
userDriverEnterpriseDo.setUserIdcardLong(userDriverEnterpriseDo.getDriverCorpIdcardLong()); // 注意类型转换
|
||||
userDriverEnterpriseDo.setUserIdcardDateTo(userDriverEnterpriseDo.getDriverCorpIdcardDateTo());
|
||||
}
|
||||
|
||||
private void validateEnterpriseRoadLicense(UserDriverEnterpriseDo userDriverEnterpriseDo, UserConfigSwitchPo configSwitch) {
|
||||
if (configSwitch.getRoadTransportVerification() == UserDriverConstants.AUTOMATIC_CHECK_ENABLED // 假设 1 代表启用
|
||||
&& StringUtils.isNotBlank(userDriverEnterpriseDo.getDriverBusinessLicenseNumber())
|
||||
&& StringUtils.isNotBlank(userDriverEnterpriseDo.getDriverBusinessLicenseOwner())) {
|
||||
EnterpriseRoadLicenseDTO enterpriseRoadLicenseDTO = new EnterpriseRoadLicenseDTO();
|
||||
enterpriseRoadLicenseDTO.setComp(userDriverEnterpriseDo.getDriverBusinessLicenseNumber());
|
||||
enterpriseRoadLicenseDTO.setCorpRoadTransport(userDriverEnterpriseDo.getDriverBusinessLicenseOwner());
|
||||
AjaxResult ajaxResult = thirdPartyServiceFeign.enterpriseRoadLicenseV3(enterpriseRoadLicenseDTO);
|
||||
|
||||
if (!UserDriverConstants.DICT_CODE_SUCCESS.equals(String.valueOf(ajaxResult.get(UserDriverConstants.DICT_KEY_CODE)))) {
|
||||
throw new ServiceException("验证企业道路运输经营许可证失败: " + ajaxResult.get("msg"));
|
||||
}
|
||||
JSONObject dataJson = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get(UserDriverConstants.DICT_KEY_DATA)));
|
||||
if (dataJson == null || dataJson.getJSONObject("result") == null) {
|
||||
throw new ServiceException("验证企业道路运输经营许可证返回结果格式不正确");
|
||||
}
|
||||
JSONObject resultJson = dataJson.getJSONObject("result"); // 使用 fastjson
|
||||
String licenseCodeIsEquals = resultJson.getString("licenseCodeIsEquals");//0- 不一致;1-一致
|
||||
if (!"1".equals(licenseCodeIsEquals)) {
|
||||
throw new ServiceException("验证企业道路运输经营许可证号不匹配");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processAuditAndNotifications(UserDriverEnterpriseDo userDriverEnterpriseDo, UserConfigSwitchPo configSwitch, LoginUser loginUser) {
|
||||
if (ObjectUtil.equal(configSwitch.getAutomaticCheckUserInfo(), UserDriverConstants.AUTOMATIC_CHECK_ENABLED)) {
|
||||
UserDriverDO authDriver = new UserDriverDO();
|
||||
authDriver.setAutomaticCheckUserInfo(UserDriverConstants.AUTOMATIC_CHECK_ENABLED);
|
||||
authDriver.setAuthType(UserDriverConstants.AUTH_TYPE_COMPANY); // 企业认证类型
|
||||
authDriver.setDriverAuthStatus(UserDriverConstants.AUTH_STATUS_APPROVED); // 直接审核通过
|
||||
authDriver.setUserId(userDriverEnterpriseDo.getUserId());
|
||||
userDriverApplicationService.authDriver(authDriver);
|
||||
} else {
|
||||
// 提交认证、推送通知消息
|
||||
driverPendingReviewPush(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理时间是否长期问题
|
||||
*/
|
||||
public void refreshDateLong(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
|
||||
if (ObjectUtil.isNull(userDriverEnterpriseDo.getUserId())) {
|
||||
//身份证前置判断
|
||||
if (userDriverEnterpriseDo.getUserIdcardLong() != null && userDriverEnterpriseDo.getUserIdcardLong() == 1) {
|
||||
userDriverEnterpriseDo.setUserIdcardDateTo(null);
|
||||
userDriverEnterpriseDo.setUserIdcardDateFrom(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//身份证有效期
|
||||
if (userDriverEnterpriseDo.getUserIdcardLong() != null && userDriverEnterpriseDo.getUserIdcardLong() == 1) {
|
||||
userDriverEnterpriseDo.setUserIdcardDateTo(null);
|
||||
userDriverEnterpriseDo.setUserIdcardDateFrom(null);
|
||||
userDomainService.blankIdCardTime(userDriverEnterpriseDo.getUserId());
|
||||
}
|
||||
|
||||
//营业期限有效期
|
||||
if (userDriverEnterpriseDo.getDriverEnterpriseLicenseLong() != null && userDriverEnterpriseDo.getDriverEnterpriseLicenseLong() == 1) {
|
||||
userDriverEnterpriseDo.setDriverEnterpriseLicenseDateTo(null);
|
||||
userDriverEnterpriseDo.setDriverEnterpriseLicenseDateFrom(null);
|
||||
userDriverEnterpriseDomainService.blankDriverEnterpriseLicenseTime(userDriverEnterpriseDo.getUserId());
|
||||
}
|
||||
|
||||
//法人身份证有效期
|
||||
if (userDriverEnterpriseDo.getDriverCorpIdcardLong() != null && userDriverEnterpriseDo.getDriverCorpIdcardLong() == 1) {
|
||||
userDriverEnterpriseDo.setDriverCorpIdcardDateTo(null);
|
||||
userDriverEnterpriseDo.setDriverCorpIdcardDateFrom(null);
|
||||
userDriverEnterpriseDomainService.blankDriverCorpIdcardTime(userDriverEnterpriseDo.getUserId());
|
||||
}
|
||||
|
||||
//经营许可证有效期
|
||||
if (userDriverEnterpriseDo.getDriverBusinessLicenseLong() != null && userDriverEnterpriseDo.getDriverBusinessLicenseLong() == 1) {
|
||||
userDriverEnterpriseDo.setDriverBusinessLicenseDateTo(null);
|
||||
userDriverEnterpriseDo.setDriverBusinessLicenseDateFrom(null);
|
||||
userDriverEnterpriseDomainService.blankDriverBusinessLicenseTime(userDriverEnterpriseDo.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Long> selectUserIdListByUserId(Long userId) {
|
||||
return userDriverEnterpriseDomainService.selectUserIdListByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 承运车队长认证
|
||||
*
|
||||
* @param userDriverEnterpriseDo 包含用户和车队长企业信息的DO
|
||||
* @return 包含userId的Map
|
||||
*/
|
||||
@NeedSetValueField
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> captainAuth(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 1. 前置检查:如果用户已存在,检查是否已加入其他车队
|
||||
performPreChecks(userDriverEnterpriseDo);
|
||||
|
||||
// 2. 刷新时间戳相关字段 ()
|
||||
refreshDateLong(userDriverEnterpriseDo);
|
||||
|
||||
// 3. 创建或更新用户基础信息 (UserPo)
|
||||
Long userId = createOrUpdateUserForCaptain(userDriverEnterpriseDo);
|
||||
userDriverEnterpriseDo.setUserId(userId); // 确保userId回填
|
||||
result.put("userId", userId);
|
||||
|
||||
// 4. 保存或更新车队长企业信息 (UserDriverEnterprisePo)
|
||||
saveOrUpdateCaptainEnterpriseInfo(userDriverEnterpriseDo);
|
||||
// 6. 新建车队
|
||||
Long motorcadeId=motorcadeApplicationService.createMotorcadeForCaptainAuth(
|
||||
userId,
|
||||
userDriverEnterpriseDo.getUserName(),
|
||||
userDriverEnterpriseDo.getUserAccount(),
|
||||
userDriverEnterpriseDo.getUserName()+"车队");
|
||||
userDriverEnterpriseDo.setSzwlMotorcadeId(motorcadeId);
|
||||
userDriverEnterpriseDo.setCarrierType(1);
|
||||
// 5. 处理认证后续步骤:同步、审核
|
||||
processCaptainPostAuthSteps(userDriverEnterpriseDo, loginUser);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void performPreChecks(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
if (userDriverEnterpriseDo.getUserId() != null) {
|
||||
List<MotorcadePo> allOtherMotorcade = motorcadeDomainService.getAllOtherMotorcade(userDriverEnterpriseDo.getUserId());
|
||||
if (allOtherMotorcade != null && !allOtherMotorcade.isEmpty()) {
|
||||
throw new ServiceException("请先离开您已加入的其他车队,才能认证为车队长。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Long createOrUpdateUserForCaptain(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
UserDO userDO = new UserDO();
|
||||
// 复制时忽略空值,避免覆盖已有数据的不必要字段
|
||||
BeanUtils.copyProperties(userDriverEnterpriseDo, userDO, IgnoreNullUtil.getNullPropertyNames(userDriverEnterpriseDo));
|
||||
|
||||
// 关键信息设置
|
||||
userDO.setUserPhone(userDriverEnterpriseDo.getUserAccount()); // 手机号通常作为账号
|
||||
// userDO.setUserName(userDriverEnterpriseDo.getEnterpriseName()); // 或其他表示用户名的字段
|
||||
|
||||
if (userDriverEnterpriseDo.getUserId() == null) {
|
||||
// ========== 新用户注册 ==========
|
||||
UserPo newUserPo = userApplicationService.addCaptainUser(userDO);
|
||||
return newUserPo.getUserId();
|
||||
} else {
|
||||
userDO.setRoleCode("captain");
|
||||
// ========== 更新现有用户信息 ==========
|
||||
userDO.setUserId(userDriverEnterpriseDo.getUserId());
|
||||
// 更新用户时,将其认证状态标记为审核通过
|
||||
userDO.setUserAuthStatus(UserDriverConstants.AUTH_STATUS_APPROVED);
|
||||
userApplicationService.updateUser(userDO); // 确保这是 updateUser 而非 addUser
|
||||
return userDO.getUserId();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveOrUpdateCaptainEnterpriseInfo(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
if (ObjectUtil.isNull(userDriverEnterpriseDo.getUserId())) {
|
||||
throw new DigitalLogisticsException(UserError.USER_NULL, "用户ID未设置,无法保存车队长信息");
|
||||
}
|
||||
|
||||
// 刷新车辆相关字典数据 (如果车队长认证也需要)
|
||||
refreshVehicleDictData(userDriverEnterpriseDo);
|
||||
|
||||
userDriverEnterpriseDo.setDriverEnterpriseCode(userDriverEnterpriseDo.getUserAccount()); // 企业编码通常用账号
|
||||
userDriverEnterpriseDo.setDriverType(UserDriverConstants.DRIVER_TYPE_CAPTAIN); // 2: 承运车队长
|
||||
userDriverEnterpriseDo.setDriverCaptainFill(UserDriverConstants.AUTH_STATUS_APPROVED); // 2: 表单填写完毕
|
||||
|
||||
UserDriverEnterprisePo existingCaptainInfo = userDriverEnterpriseDomainService.getCaptainInfoByUserId(userDriverEnterpriseDo.getUserId());
|
||||
|
||||
if (ObjectUtil.isNull(existingCaptainInfo)) {
|
||||
userDriverEnterpriseDomainService.insert(userDriverEnterpriseDo);
|
||||
} else {
|
||||
userDriverEnterpriseDo.setUserDriverEnterpriseId(existingCaptainInfo.getUserDriverEnterpriseId());
|
||||
userDriverEnterpriseDomainService.update(userDriverEnterpriseDo);
|
||||
}
|
||||
}
|
||||
|
||||
private void processCaptainPostAuthSteps(UserDriverEnterpriseDo userDriverEnterpriseDo, LoginUser loginUser) {
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (ObjectUtil.isNull(configSwitch)) {
|
||||
throw new ServiceException("获取组织配置失败");
|
||||
}
|
||||
|
||||
// 向网络货运同步承运人信息 (车队长作为一种承运人)
|
||||
wlhyDomainService.saveOrUpdateCarrierInfo(userDriverEnterpriseDo);
|
||||
|
||||
// 自动审核用户信息
|
||||
if (ObjectUtil.equal(configSwitch.getAutomaticCheckUserInfo(), UserDriverConstants.AUTOMATIC_CHECK_ENABLED)) {
|
||||
UserDriverDO authInfo = new UserDriverDO(); // 使用 UserDriverDO 进行通用审核
|
||||
authInfo.setAutomaticCheckUserInfo(UserDriverConstants.AUTOMATIC_CHECK_ENABLED);
|
||||
authInfo.setAuthType(UserDriverConstants.AUTH_TYPE_CAPTAIN); // 2: 认证类型为车队长
|
||||
authInfo.setDriverAuthStatus(UserDriverConstants.AUTH_STATUS_APPROVED); // 3: 审核通过
|
||||
authInfo.setUserId(userDriverEnterpriseDo.getUserId());
|
||||
userDriverApplicationService.authDriver(authInfo);
|
||||
} else {
|
||||
// 提交认证、推送待审核通知消息
|
||||
driverPendingReviewPush(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 刷新承运人数据字典/省市县信息
|
||||
* @Author Alex
|
||||
* @Date 2023/1/7 11:28
|
||||
*/
|
||||
public UserDriverEnterpriseDo refreshVehicleDictData(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
//根据县区编码获取省市县名称
|
||||
if (ObjectUtil.isNotNull(userDriverEnterpriseDo.getUserAreaCountyId()) && Strings.isNullOrEmpty(userDriverEnterpriseDo.getUserAreaName())) {
|
||||
SysProvinceCityCountyDTO sysProvinceCityCountyDTO = new SysProvinceCityCountyDTO();
|
||||
sysProvinceCityCountyDTO.setCountyCode(userDriverEnterpriseDo.getUserAreaCountyId());
|
||||
AjaxResult sysAreaPOInfo = systemServiceFeign.findAreaInfo(sysProvinceCityCountyDTO);
|
||||
Object sysAreaPOData = sysAreaPOInfo.get("data");
|
||||
if (ObjectUtil.isNotNull(sysAreaPOData)) {
|
||||
SysAreaPO sysAreaPO = (SysAreaPO) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(sysAreaPOData), SysAreaPO.class);
|
||||
if (ObjectUtil.isNotNull(sysAreaPO)) {
|
||||
userDriverEnterpriseDo.setUserAreaName(sysAreaPO.getProvinceCityCountyName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return userDriverEnterpriseDo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 托运人待审核推送
|
||||
*/
|
||||
public void driverPendingReviewPush(LoginUser loginUser) {
|
||||
//是否消息弹框提醒
|
||||
UserConfigSwitchPo configSwitch = commonApplicationService.getUserConfigSwitch();
|
||||
if (configSwitch.getIsComplaintAlert() == 1) {
|
||||
//提交认证、提送通知消息
|
||||
//临时暂定为组织负责人
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("title", "承运人待审核通知");
|
||||
map.put("content", "您有一条新的承运人认证待审批,请尽快处理!");
|
||||
|
||||
WebSocketDTO webSocketDTO = new WebSocketDTO();
|
||||
webSocketDTO.setUserId(loginUser.getOrganizationPo().getPrincipalId().toString());
|
||||
webSocketDTO.setType(WebsocketTypeEnum.PENDING_REVIEW.getCode());
|
||||
webSocketDTO.setListFlag("1");
|
||||
webSocketDTO.setData(map);
|
||||
webSocketDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
|
||||
asyncWebSocketApplicationService.oneSend(webSocketDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@DataPermissions(cacheName = "master")
|
||||
public List<UserDriverEnterprisePo> queryCaptainList(UserDriverEnterpriseDo userDriverEnterpriseDo) {
|
||||
return userDriverEnterpriseDomainService.queryCaptainList(userDriverEnterpriseDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userId
|
||||
* @return UserDriverEnterprisePo
|
||||
* @description TODO
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/25 10:07
|
||||
*/
|
||||
public UserDriverEnterprisePo getCaptainInfoByUserId(Long userId) {
|
||||
return userDriverEnterpriseDomainService.getCaptainInfoByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户id查询用户企业信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public UserDriverEnterprisePo getEnterpriseByUserId(Long userId) {
|
||||
return userDriverEnterpriseDomainService.getEnterpriseByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param driverEnterpriseCode
|
||||
* @return UserDriverEnterprisePo
|
||||
* @description 根据企业
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/25 10:45
|
||||
*/
|
||||
public UserDriverEnterprisePo getDriverEnterpriseInfoByOpen(String driverEnterpriseCode) {
|
||||
OpenDriverDto openDriverDto = new OpenDriverDto();
|
||||
openDriverDto.setDriverEnterpriseCode(driverEnterpriseCode);
|
||||
openDriverDto.setDataSources(2);
|
||||
UserEntity userEntity = userDomainService.getDriverEnterpriseByCode(openDriverDto);
|
||||
|
||||
if (ObjectUtil.isNotNull(userEntity)) {
|
||||
UserDriverEnterprisePo userDriverEnterprisePo = userDriverEnterpriseDomainService.getInfoByUserId(userEntity.getUserId());
|
||||
if (ObjectUtil.isNotNull(userDriverEnterprisePo)) {
|
||||
return userDriverEnterprisePo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1025
File diff suppressed because it is too large
Load Diff
+39
@@ -0,0 +1,39 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.user.application.strategy.VehicleBindingStrategy;
|
||||
import com.mhd.user.application.strategy.impI.BindToExistingVehicleStrategy;
|
||||
import com.mhd.user.application.strategy.impI.CreateAndBindNewVehicleStrategy;
|
||||
import com.mhd.user.application.strategy.impI.HandleBoundVehicleStrategy;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class VehicleBindingStrategyFactory {
|
||||
|
||||
private final HandleBoundVehicleStrategy handleBoundVehicleStrategy;
|
||||
|
||||
private final BindToExistingVehicleStrategy bindToExistingVehicleStrategy;
|
||||
|
||||
private final CreateAndBindNewVehicleStrategy createAndBindNewVehicleStrategy;
|
||||
|
||||
/**
|
||||
* 根据车辆状态选择合适地绑定策略
|
||||
* @param vehicle 从仓查询到的车辆
|
||||
* @param isBound 车辆是否已绑定状态标识
|
||||
* @return 匹配的策略实例
|
||||
*/
|
||||
public VehicleBindingStrategy getStrategy(VehiclePo vehicle,boolean isBound) {
|
||||
if (Objects.nonNull(vehicle)) {
|
||||
if (isBound) {
|
||||
return handleBoundVehicleStrategy;
|
||||
} else {
|
||||
return bindToExistingVehicleStrategy;
|
||||
}
|
||||
} else {
|
||||
return createAndBindNewVehicleStrategy;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mhd.user.application.strategy;
|
||||
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
|
||||
/**
|
||||
* 定义了为司机绑定车辆的策略接口。
|
||||
* 策略的职责是准备好车辆(已有的或新建的),并将其与司机关联。
|
||||
*/
|
||||
public interface VehicleBindingStrategy {
|
||||
/**
|
||||
* 执行车辆绑定策略
|
||||
*
|
||||
* @param driver 司机实体对象,包含司机的相关信息
|
||||
* @param vehicle 车辆PO对象,包含车辆的详细信息
|
||||
*/
|
||||
void execute(UserDriverDO driver, VehiclePo vehicle);
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.mhd.user.application.strategy.impI;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.user.application.service.UserApplicationService;
|
||||
import com.mhd.user.application.strategy.VehicleBindingStrategy;
|
||||
import com.mhd.user.domain.userAggregate.repository.facade.DriverVehicleBindService;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.DriverVehicleBindDo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.service.UserWlhyDomainService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
@RequiredArgsConstructor
|
||||
public class BindToExistingVehicleStrategy implements VehicleBindingStrategy {
|
||||
|
||||
private final UserWlhyDomainService wlhyDomainService;
|
||||
|
||||
private final DriverVehicleBindService driverVehicleBindService;
|
||||
|
||||
private final UserApplicationService userApplicationService;
|
||||
|
||||
@Override
|
||||
public void execute(UserDriverDO driver, VehiclePo vehicle) {
|
||||
log.info("执行创建车辆绑定策略类代码");
|
||||
UserPo user = userApplicationService.selectUserTableByUserId(driver.getUserId());
|
||||
DriverVehicleBindDo driverVehicleBindDo = new DriverVehicleBindDo();
|
||||
driverVehicleBindDo.setUserId(driver.getUserId());
|
||||
driverVehicleBindDo.setVehicleId(vehicle.getVehicleId());
|
||||
driverVehicleBindDo.setDriverBindId(driver.getUserId());
|
||||
driverVehicleBindDo.setBindDriverName(user.getUserName());
|
||||
driverVehicleBindDo.setBindDriverPhone(user.getUserPhone());
|
||||
driverVehicleBindDo.setTopOrganizationId(user.getTopOrganizationId());
|
||||
driverVehicleBindDo.setOrganizationId(user.getTopOrganizationId());
|
||||
driverVehicleBindDo.setVehicleLicensePlateNumber(vehicle.getVehicleLicensePlateNumber());
|
||||
driverVehicleBindDo.setVehicleTypeId(vehicle.getVehicleTypeId());
|
||||
driverVehicleBindDo.setVehicleTypeName(vehicle.getVehicleTypeName());
|
||||
driverVehicleBindDo.setVehicleCheckoutPeriodValidity(
|
||||
DateUtil.parse(vehicle.getVehicleCheckoutPeriodValidity()));
|
||||
driverVehicleBindDo.setBusinessLicenseExpireEndDate(
|
||||
DateUtil.parse(vehicle.getBusinessLicenseExpireEndDate()));
|
||||
driverVehicleBindDo.setBusinessLicenseLongStatus(vehicle.getBusinessLicenseLongStatus());
|
||||
driverVehicleBindDo.setRoadTransportCertificateExpireDate(
|
||||
DateUtil.parse(vehicle.getRoadTransportCertificateExpireDate()));
|
||||
driverVehicleBindDo.setRoadTransportCertificateLongStatus(
|
||||
vehicle.getRoadTransportCertificateLongStatus());
|
||||
driverVehicleBindDo.setDefaultFlag(1);
|
||||
driverVehicleBindDo.setCreateBy(user.getUserId());
|
||||
driverVehicleBindDo.setCreateByName(user.getUserName());
|
||||
driverVehicleBindDo.setCreateTime(DateUtil.date());
|
||||
log.info("绑定信息:{}",driverVehicleBindDo);
|
||||
Boolean flag = driverVehicleBindService.insert(driverVehicleBindDo);
|
||||
if (flag) {
|
||||
//向网货同步绑定车辆信息
|
||||
log.info("向网货同步绑定车辆信息");
|
||||
wlhyDomainService.binding(driverVehicleBindDo);
|
||||
}
|
||||
log.info("完成创建车辆绑定策略类代码");
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.mhd.user.application.strategy.impI;
|
||||
|
||||
import com.mhd.common.core.domain.dto.VehicleDto;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.system.api.TransportFeign;
|
||||
import com.mhd.user.application.strategy.VehicleBindingStrategy;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
@RequiredArgsConstructor
|
||||
public class CreateAndBindNewVehicleStrategy implements VehicleBindingStrategy {
|
||||
|
||||
private final TransportFeign transportFeign;
|
||||
|
||||
@Override
|
||||
public void execute(UserDriverDO driver, VehiclePo vehicle) {
|
||||
log.info("执行创建车辆并绑定策略类代码");
|
||||
VehicleDto dto = new VehicleDto();
|
||||
|
||||
dto.setVehicleLicensePlateNumber(driver.getVehicleLicensePlateNumber());
|
||||
dto.setVehicleTypeId(driver.getVehicleTypeId());
|
||||
dto.setVehicleTypeName(driver.getVehicleTypeName());
|
||||
dto.setVehicleUsePerson(driver.getUserName());
|
||||
dto.setUserId(driver.getUserId());
|
||||
dto.setUserName(driver.getUserName());
|
||||
dto.setUserPhone(driver.getUserAccount());
|
||||
dto.setVehicleSource(driver.getUserCarType());
|
||||
dto.setMotorcadeId(driver.getMotorcadeId());
|
||||
dto.setMotorcadeName(driver.getMotorcadeName());
|
||||
dto.setDepartmentId(driver.getDepartmentId());
|
||||
R<Void> result = transportFeign.addForUserApp(dto);
|
||||
|
||||
if (result.getCode() != 200) {
|
||||
log.warn("feign远程调用新增车辆接口失败 msg:{}", result.getMsg());
|
||||
throw new RuntimeException("新增车辆失败,请重试!");
|
||||
}
|
||||
log.info("结束创建车辆并绑定策略类代码");
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mhd.user.application.strategy.impI;
|
||||
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.user.application.strategy.VehicleBindingStrategy;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDriverDO;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
public class HandleBoundVehicleStrategy implements VehicleBindingStrategy {
|
||||
|
||||
@Override
|
||||
public void execute(UserDriverDO driver, VehiclePo vehicle) {
|
||||
log.warn("车牌号 {} 已被绑定!",driver.getVehicleLicensePlateNumber());
|
||||
throw new RuntimeException(String.format("车牌号 %s 已被绑定,请确认。", driver.getVehicleLicensePlateNumber()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
## 领域层
|
||||
|
||||
活儿都给domainService干,异常都给domainService抛
|
||||
|
||||
1、领域中的对象由实体和值对象组成。对值对象的访问必须经由所属的实体对象;
|
||||
|
||||
2、相关联的一组实体与值对象组成聚合,对聚合内的对象的访问必须经由聚合根对象。
|
||||
|
||||
3、跨实体的操作必须经由领域服务。
|
||||
|
||||
4、应用服务层只通过领域服务或者聚合根来组织业务,自身不带任务实现逻辑。
|
||||
|
||||
5、业务与数据隔离。领域层只关注业务,数据支撑全部交由基础层
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mhd.user.domain.appLocation.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;
|
||||
|
||||
|
||||
/**
|
||||
* APP位置信息对象 app_location
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppLocation extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP位置id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long appLocationId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("速度")
|
||||
@Excel(name = "速度")
|
||||
private Long speed;
|
||||
|
||||
@ApiModelProperty("位置信息")
|
||||
@Excel(name = "位置信息")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("运单号")
|
||||
@Excel(name = "运单号")
|
||||
private String waybillNum;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String licensePlate;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.user.domain.appLocation.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.appLocation.entity.AppLocation;
|
||||
import com.mhd.user.domain.appLocation.repository.po.AppLocationPO;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP位置信息Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
public interface IAppLocationService extends IService<AppLocation>
|
||||
{
|
||||
/**
|
||||
* 分页查询APP位置信息列表
|
||||
*/
|
||||
public List<AppLocationPO> queryList(AppLocationDO appLocationDO);
|
||||
|
||||
/**
|
||||
* 新增APP位置信息
|
||||
*/
|
||||
public Boolean insert(AppLocationDO appLocationDO);
|
||||
|
||||
/**
|
||||
* 修改APP位置信息
|
||||
*/
|
||||
public Boolean update(AppLocationDO appLocationDO);
|
||||
|
||||
/**
|
||||
* 批量删除APP位置信息
|
||||
*/
|
||||
public Boolean delete(Long[] appLocationIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询APP位置信息
|
||||
*/
|
||||
public AppLocationPO getInfo(Long appLocationId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.user.domain.appLocation.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.appLocation.entity.AppLocation;
|
||||
import com.mhd.user.domain.appLocation.repository.po.AppLocationPO;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* APP位置信息Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
public interface AppLocationMapper extends BaseMapper<AppLocation>
|
||||
{
|
||||
/**
|
||||
* 查询APP位置信息列表
|
||||
*/
|
||||
public List<AppLocationPO> queryList(AppLocationDO appLocationDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.mhd.user.domain.appLocation.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.appLocation.entity.AppLocation;
|
||||
import com.mhd.user.domain.appLocation.repository.facade.IAppLocationService;
|
||||
import com.mhd.user.domain.appLocation.repository.mapper.AppLocationMapper;
|
||||
import com.mhd.user.domain.appLocation.repository.po.AppLocationPO;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* APP位置信息Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
public class AppLocationImpl extends ServiceImpl<AppLocationMapper, AppLocation> implements IAppLocationService{
|
||||
@Autowired
|
||||
private AppLocationMapper appLocationMapper;
|
||||
|
||||
/**
|
||||
* 查询APP位置信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppLocationPO> queryList(AppLocationDO appLocationDO)
|
||||
{
|
||||
return appLocationMapper.queryList(appLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(AppLocationDO appLocationDO) {
|
||||
AppLocation appLocation = new AppLocation();
|
||||
BeanUtils.copyProperties(appLocationDO,appLocation);
|
||||
return this.save(appLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(AppLocationDO appLocationDO) {
|
||||
AppLocation appLocation = new AppLocation();
|
||||
BeanUtils.copyProperties(appLocationDO,appLocation);
|
||||
return this.updateById(appLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除APP位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] appLocationIds ) {
|
||||
List<AppLocation> list = new ArrayList<>();
|
||||
for (Long id : appLocationIds) {
|
||||
AppLocation appLocation = new AppLocation();
|
||||
appLocation.setAppLocationId(id);
|
||||
appLocation.setDelFlag(2);
|
||||
list.add(appLocation);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP位置信息
|
||||
*/
|
||||
@Override
|
||||
public AppLocationPO getInfo(Long appLocationId) {
|
||||
AppLocation appLocation = this.getById(appLocationId);
|
||||
AppLocationPO appLocationPO = new AppLocationPO();
|
||||
BeanUtils.copyProperties(appLocation,appLocationPO);
|
||||
return appLocationPO;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.mhd.user.domain.appLocation.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;
|
||||
|
||||
|
||||
/**
|
||||
* APP位置信息对象 app_location
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "APP位置信息对象", description = "APP位置信息响应对象")
|
||||
public class AppLocationPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP位置id")
|
||||
private Long appLocationId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("速度")
|
||||
@Excel(name = "速度")
|
||||
private Long speed;
|
||||
|
||||
@ApiModelProperty("位置信息")
|
||||
@Excel(name = "位置信息")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("运单号")
|
||||
@Excel(name = "运单号")
|
||||
private String waybillNum;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String licensePlate;
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.mhd.user.domain.appLocation.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 车辆定位
|
||||
* @Author: lfs
|
||||
* @Date: 2020-03-09 10:55:11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class TmsVehicleLocationVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ID_WORKER_STR)
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**是否删除(0-未删除,1-已删除)*/
|
||||
@ApiModelProperty(value = "是否删除(0-未删除,1-已删除)")
|
||||
private Integer isDelete;
|
||||
/**车辆id*/
|
||||
@ApiModelProperty(value = "车辆id")
|
||||
private String vehicleId;
|
||||
/**车牌号*/
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
private String vehicleLicenseNumber;
|
||||
/**司机编码*/
|
||||
@ApiModelProperty(value = "司机编码")
|
||||
private String driverId;
|
||||
/**经度*/
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String longitude;
|
||||
/**纬度*/
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String latitude;
|
||||
/**详细地址*/
|
||||
@ApiModelProperty(value = "详细地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "运单号")
|
||||
private String transportationNumber;
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.mhd.user.domain.appLocation.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;
|
||||
|
||||
|
||||
/**
|
||||
* APP位置信息对象 app_location
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class AppLocationDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("APP位置id")
|
||||
private Long appLocationId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("速度")
|
||||
@Excel(name = "速度")
|
||||
private Long speed;
|
||||
|
||||
@ApiModelProperty("位置信息")
|
||||
@Excel(name = "位置信息")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("运单号")
|
||||
@Excel(name = "运单号")
|
||||
private String waybillNum;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty(value = "开始日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty(value = "定位方式(0-APP定位,1-中交行路,2-好运宝轨迹)")
|
||||
private Integer type;
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.mhd.user.domain.appLocation.service;
|
||||
|
||||
import com.mhd.user.domain.appLocation.repository.facade.IAppLocationService;
|
||||
import com.mhd.user.domain.appLocation.repository.po.AppLocationPO;
|
||||
import com.mhd.user.domain.appLocation.repository.todo.AppLocationDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* APP位置信息
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AppLocationDomainService {
|
||||
|
||||
@Autowired
|
||||
private IAppLocationService appLocationService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询APP位置信息列表
|
||||
*/
|
||||
public List<AppLocationPO> queryList(AppLocationDO appLocationDO) {
|
||||
return appLocationService.queryList(appLocationDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增APP位置信息
|
||||
*/
|
||||
public Boolean insert(AppLocationDO appLocationDO) {
|
||||
|
||||
return appLocationService.insert(appLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP位置信息
|
||||
*/
|
||||
public Boolean update(AppLocationDO appLocationDO) {
|
||||
return appLocationService.update(appLocationDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除APP位置信息
|
||||
*/
|
||||
public Boolean delete(Long[] appLocationIds) {
|
||||
return appLocationService.delete(appLocationIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP位置信息详细信息
|
||||
*/
|
||||
public AppLocationPO getInfo(Long appLocationId)
|
||||
{
|
||||
return appLocationService.getInfo(appLocationId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.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;
|
||||
|
||||
|
||||
/**
|
||||
* 司机当前位置信息对象 driver_current_position
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DriverCurrentPosition extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("司机位置id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long driverCurrentPositionId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("位置信息")
|
||||
@Excel(name = "位置信息")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty("行进方向")
|
||||
@Excel(name = "行进方向")
|
||||
private String drivingDirection;
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.driverCurrentPosition.entity.DriverCurrentPosition;
|
||||
import com.mhd.common.core.domain.DriverCurrentPositionPO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机当前位置信息Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
public interface IDriverCurrentPositionService extends IService<DriverCurrentPosition>
|
||||
{
|
||||
/**
|
||||
* 分页查询司机当前位置信息列表
|
||||
*/
|
||||
public List<DriverCurrentPositionPO> queryList(DriverCurrentPositionDO driverCurrentPositionDO);
|
||||
|
||||
/**
|
||||
* 新增司机当前位置信息
|
||||
*/
|
||||
public Boolean insert(DriverCurrentPositionDO driverCurrentPositionDO);
|
||||
|
||||
/**
|
||||
* 修改司机当前位置信息
|
||||
*/
|
||||
public Boolean update(DriverCurrentPositionDO driverCurrentPositionDO);
|
||||
|
||||
/**
|
||||
* 批量删除司机当前位置信息
|
||||
*/
|
||||
public Boolean delete(Long[] driverCurrentPositionIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询司机当前位置信息
|
||||
*/
|
||||
public DriverCurrentPositionPO getInfo(Long driverCurrentPositionId);
|
||||
|
||||
DriverCurrentPositionPO getDriverLatestLocation(Long userId);
|
||||
|
||||
List<Long> getOnlineDriver(Date time);
|
||||
|
||||
List<DriverCurrentPositionPO> getOnlineVehicle(Date time);
|
||||
|
||||
List<DriverCurrentPositionPO> getOfflineVehicle(Date time);
|
||||
|
||||
DriverCurrentPositionPO getVehicleLatestLocation(String licensePlate);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.repository.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.driverCurrentPosition.entity.DriverCurrentPosition;
|
||||
import com.mhd.common.core.domain.DriverCurrentPositionPO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 司机当前位置信息Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
public interface DriverCurrentPositionMapper extends BaseMapper<DriverCurrentPosition>
|
||||
{
|
||||
/**
|
||||
* 查询司机当前位置信息列表
|
||||
*/
|
||||
public List<DriverCurrentPositionPO> queryList(DriverCurrentPositionDO driverCurrentPositionDO);
|
||||
|
||||
DriverCurrentPositionPO getDriverLatestLocation(@Param("userId") Long userId);
|
||||
|
||||
List<Long> getOnlineDriver(@Param("time") Date time);
|
||||
|
||||
List<DriverCurrentPositionPO> getOnlineVehicle(@Param("time") Date time);
|
||||
|
||||
List<DriverCurrentPositionPO> getOfflineVehicle(@Param("time") Date time);
|
||||
|
||||
DriverCurrentPositionPO getVehicleLatestLocation(String licensePlate);
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.driverCurrentPosition.entity.DriverCurrentPosition;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.facade.IDriverCurrentPositionService;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.mapper.DriverCurrentPositionMapper;
|
||||
import com.mhd.common.core.domain.DriverCurrentPositionPO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 司机当前位置信息Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
public class DriverCurrentPositionImpl extends ServiceImpl<DriverCurrentPositionMapper, DriverCurrentPosition> implements IDriverCurrentPositionService{
|
||||
@Autowired
|
||||
private DriverCurrentPositionMapper driverCurrentPositionMapper;
|
||||
|
||||
/**
|
||||
* 查询司机当前位置信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<DriverCurrentPositionPO> queryList(DriverCurrentPositionDO driverCurrentPositionDO)
|
||||
{
|
||||
return driverCurrentPositionMapper.queryList(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增司机当前位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
DriverCurrentPosition driverCurrentPosition = new DriverCurrentPosition();
|
||||
BeanUtils.copyProperties(driverCurrentPositionDO,driverCurrentPosition);
|
||||
return this.save(driverCurrentPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机当前位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
DriverCurrentPosition driverCurrentPosition = new DriverCurrentPosition();
|
||||
BeanUtils.copyProperties(driverCurrentPositionDO,driverCurrentPosition);
|
||||
return this.updateById(driverCurrentPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除司机当前位置信息
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] driverCurrentPositionIds ) {
|
||||
List<DriverCurrentPosition> list = new ArrayList<>();
|
||||
for (Long id : driverCurrentPositionIds) {
|
||||
DriverCurrentPosition driverCurrentPosition = new DriverCurrentPosition();
|
||||
driverCurrentPosition.setDriverCurrentPositionId(id);
|
||||
driverCurrentPosition.setDelFlag(2);
|
||||
list.add(driverCurrentPosition);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机当前位置信息
|
||||
*/
|
||||
@Override
|
||||
public DriverCurrentPositionPO getInfo(Long driverCurrentPositionId) {
|
||||
DriverCurrentPosition driverCurrentPosition = this.getById(driverCurrentPositionId);
|
||||
DriverCurrentPositionPO driverCurrentPositionPO = new DriverCurrentPositionPO();
|
||||
BeanUtils.copyProperties(driverCurrentPosition,driverCurrentPositionPO);
|
||||
return driverCurrentPositionPO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriverCurrentPositionPO getDriverLatestLocation(Long userId) {
|
||||
return driverCurrentPositionMapper.getDriverLatestLocation(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getOnlineDriver(Date time) {
|
||||
return driverCurrentPositionMapper.getOnlineDriver(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DriverCurrentPositionPO> getOnlineVehicle(Date time) {
|
||||
return driverCurrentPositionMapper.getOnlineVehicle(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DriverCurrentPositionPO> getOfflineVehicle(Date time) {
|
||||
return driverCurrentPositionMapper.getOfflineVehicle(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriverCurrentPositionPO getVehicleLatestLocation(String licensePlate) {
|
||||
return driverCurrentPositionMapper.getVehicleLatestLocation(licensePlate);
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.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;
|
||||
|
||||
|
||||
/**
|
||||
* 司机当前位置信息对象 driver_current_position
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DriverCurrentPositionDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("司机位置id")
|
||||
private Long driverCurrentPositionId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("位置信息")
|
||||
@Excel(name = "位置信息")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
@Excel(name = "车牌号")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty("行进方向")
|
||||
@Excel(name = "行进方向")
|
||||
private String drivingDirection;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.mhd.user.domain.driverCurrentPosition.service;
|
||||
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.facade.IDriverCurrentPositionService;
|
||||
import com.mhd.common.core.domain.DriverCurrentPositionPO;
|
||||
import com.mhd.user.domain.driverCurrentPosition.repository.todo.DriverCurrentPositionDO;
|
||||
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;
|
||||
/**
|
||||
* 司机当前位置信息
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-01-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DriverCurrentPositionDomainService {
|
||||
|
||||
@Autowired
|
||||
private IDriverCurrentPositionService driverCurrentPositionService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询司机当前位置信息列表
|
||||
*/
|
||||
public List<DriverCurrentPositionPO> queryList(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
return driverCurrentPositionService.queryList(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增司机当前位置信息
|
||||
*/
|
||||
public Boolean insert(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
|
||||
return driverCurrentPositionService.insert(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改司机当前位置信息
|
||||
*/
|
||||
public Boolean update(DriverCurrentPositionDO driverCurrentPositionDO) {
|
||||
return driverCurrentPositionService.update(driverCurrentPositionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除司机当前位置信息
|
||||
*/
|
||||
public Boolean delete(Long[] driverCurrentPositionIds) {
|
||||
return driverCurrentPositionService.delete(driverCurrentPositionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机当前位置信息详细信息
|
||||
*/
|
||||
public DriverCurrentPositionPO getInfo(Long driverCurrentPositionId)
|
||||
{
|
||||
return driverCurrentPositionService.getInfo(driverCurrentPositionId);
|
||||
}
|
||||
|
||||
|
||||
public DriverCurrentPositionPO getDriverLatestLocation(Long userId) {
|
||||
return driverCurrentPositionService.getDriverLatestLocation(userId);
|
||||
}
|
||||
|
||||
public List<Long> getOnlineDriver(Date time) {
|
||||
return driverCurrentPositionService.getOnlineDriver(time);
|
||||
}
|
||||
|
||||
public List<DriverCurrentPositionPO> getOnlineVehicle(Date time) {
|
||||
return driverCurrentPositionService.getOnlineVehicle(time);
|
||||
}
|
||||
|
||||
public List<DriverCurrentPositionPO> getOfflineVehicle(Date time) {
|
||||
return driverCurrentPositionService.getOfflineVehicle(time);
|
||||
}
|
||||
|
||||
public DriverCurrentPositionPO getVehicleLatestLocation(String licensePlate) {
|
||||
return driverCurrentPositionService.getVehicleLatestLocation(licensePlate);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车主关注货主对象 driver_follow_shipper
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DriverFollowShipper extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long driverFollowShipperId;
|
||||
|
||||
@ApiModelProperty("司机用户主表ID(车主)")
|
||||
@Excel(name = "司机用户主表ID(车主)")
|
||||
private Long driverUserId;
|
||||
|
||||
@ApiModelProperty("货主用户主表ID")
|
||||
@Excel(name = "货主用户主表ID")
|
||||
private Long shipperUserId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.driverFollowShipper.entity.DriverFollowShipper;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车主关注货主Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
public interface IDriverFollowShipperService extends IService<DriverFollowShipper>
|
||||
{
|
||||
/**
|
||||
* 分页查询车主关注货主列表
|
||||
*/
|
||||
public List<DriverFollowShipperPO> queryList(DriverFollowShipperDO driverFollowShipperDO);
|
||||
|
||||
/**
|
||||
* 新增车主关注货主
|
||||
*/
|
||||
public Boolean insert(DriverFollowShipperDO driverFollowShipperDO);
|
||||
|
||||
/**
|
||||
* 修改车主关注货主
|
||||
*/
|
||||
public Boolean update(DriverFollowShipperDO driverFollowShipperDO);
|
||||
|
||||
/**
|
||||
* 批量删除车主关注货主
|
||||
*/
|
||||
public Boolean delete(Long[] driverFollowShipperIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询车主关注货主
|
||||
*/
|
||||
public DriverFollowShipperPO getInfo(Long driverFollowShipperId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.driverFollowShipper.entity.DriverFollowShipper;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 车主关注货主Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
public interface DriverFollowShipperMapper extends BaseMapper<DriverFollowShipper>
|
||||
{
|
||||
/**
|
||||
* 查询车主关注货主列表
|
||||
*/
|
||||
public List<DriverFollowShipperPO> queryList(DriverFollowShipperDO driverFollowShipperDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.driverFollowShipper.entity.DriverFollowShipper;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.facade.IDriverFollowShipperService;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.mapper.DriverFollowShipperMapper;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
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 2023-12-26
|
||||
*/
|
||||
@Service
|
||||
public class DriverFollowShipperImpl extends ServiceImpl<DriverFollowShipperMapper, DriverFollowShipper> implements IDriverFollowShipperService{
|
||||
@Autowired
|
||||
private DriverFollowShipperMapper driverFollowShipperMapper;
|
||||
|
||||
/**
|
||||
* 查询车主关注货主列表
|
||||
*/
|
||||
@Override
|
||||
public List<DriverFollowShipperPO> queryList(DriverFollowShipperDO driverFollowShipperDO)
|
||||
{
|
||||
return driverFollowShipperMapper.queryList(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车主关注货主
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
DriverFollowShipper driverFollowShipper = new DriverFollowShipper();
|
||||
BeanUtils.copyProperties(driverFollowShipperDO,driverFollowShipper);
|
||||
return this.save(driverFollowShipper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车主关注货主
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
DriverFollowShipper driverFollowShipper = new DriverFollowShipper();
|
||||
BeanUtils.copyProperties(driverFollowShipperDO,driverFollowShipper);
|
||||
return this.updateById(driverFollowShipper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车主关注货主
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] driverFollowShipperIds ) {
|
||||
List<DriverFollowShipper> list = new ArrayList<>();
|
||||
for (Long id : driverFollowShipperIds) {
|
||||
DriverFollowShipper driverFollowShipper = new DriverFollowShipper();
|
||||
driverFollowShipper.setDriverFollowShipperId(id);
|
||||
driverFollowShipper.setDelFlag(2);
|
||||
list.add(driverFollowShipper);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车主关注货主
|
||||
*/
|
||||
@Override
|
||||
public DriverFollowShipperPO getInfo(Long driverFollowShipperId) {
|
||||
DriverFollowShipper driverFollowShipper = this.getById(driverFollowShipperId);
|
||||
DriverFollowShipperPO driverFollowShipperPO = new DriverFollowShipperPO();
|
||||
BeanUtils.copyProperties(driverFollowShipper,driverFollowShipperPO);
|
||||
return driverFollowShipperPO;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车主关注货主对象 driver_follow_shipper
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车主关注货主对象", description = "车主关注货主响应对象")
|
||||
public class DriverFollowShipperPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private Long driverFollowShipperId;
|
||||
|
||||
@ApiModelProperty("司机用户主表ID(车主)")
|
||||
@Excel(name = "司机用户主表ID(车主)")
|
||||
private Long driverUserId;
|
||||
|
||||
@ApiModelProperty("货主用户主表ID")
|
||||
@Excel(name = "货主用户主表ID")
|
||||
private Long shipperUserId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车主关注货主对象 driver_follow_shipper
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DriverFollowShipperDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
private Long driverFollowShipperId;
|
||||
|
||||
@ApiModelProperty("司机用户主表ID(车主)")
|
||||
@Excel(name = "司机用户主表ID(车主)")
|
||||
private Long driverUserId;
|
||||
|
||||
@ApiModelProperty("货主用户主表ID")
|
||||
@Excel(name = "货主用户主表ID")
|
||||
private Long shipperUserId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("用户操作类型(1-关注,2-取消关注)")
|
||||
private Integer followType;
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.mhd.user.domain.driverFollowShipper.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.user.domain.driverFollowShipper.entity.DriverFollowShipper;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.facade.IDriverFollowShipperService;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.po.DriverFollowShipperPO;
|
||||
import com.mhd.user.domain.driverFollowShipper.repository.todo.DriverFollowShipperDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 车主关注货主
|
||||
*
|
||||
* @author gen
|
||||
* @date 2023-12-26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DriverFollowShipperDomainService {
|
||||
|
||||
@Autowired
|
||||
private IDriverFollowShipperService driverFollowShipperService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车主关注货主列表
|
||||
*/
|
||||
public List<DriverFollowShipperPO> queryList(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
return driverFollowShipperService.queryList(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车主关注货主
|
||||
*/
|
||||
public Boolean insert(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
|
||||
return driverFollowShipperService.insert(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车主关注货主
|
||||
*/
|
||||
public Boolean update(DriverFollowShipperDO driverFollowShipperDO) {
|
||||
return driverFollowShipperService.update(driverFollowShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车主关注货主
|
||||
*/
|
||||
public Boolean delete(Long[] driverFollowShipperIds) {
|
||||
return driverFollowShipperService.delete(driverFollowShipperIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车主关注货主详细信息
|
||||
*/
|
||||
public DriverFollowShipperPO getInfo(Long driverFollowShipperId)
|
||||
{
|
||||
return driverFollowShipperService.getInfo(driverFollowShipperId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据货主用户id 删除司机关注
|
||||
* @param shipperUserId 货主用户id
|
||||
* @param driverUserId 司机用户id
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteByShipperUserId(Long shipperUserId, Long driverUserId) {
|
||||
LambdaQueryWrapper<DriverFollowShipper> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DriverFollowShipper::getDelFlag,0);
|
||||
queryWrapper.eq(DriverFollowShipper::getShipperUserId,shipperUserId);
|
||||
queryWrapper.eq(DriverFollowShipper::getDriverUserId,driverUserId);
|
||||
return driverFollowShipperService.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.mhd.user.domain.motorcade.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 车队对象 motorcade
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Data
|
||||
public class Motorcade extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeId;
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
@ApiModelProperty(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "组织名称")
|
||||
private String organizationName;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队认证状态(1.正在审核2.认证成功3.认证失败) */
|
||||
@ApiModelProperty("车队认证状态(1.正在审核2.认证成功3.认证失败)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "1=.正在审核2.认证成功3.认证失败")
|
||||
private Long motorcadeStatus;
|
||||
@ApiModelProperty("车队审核备注")
|
||||
@Excel(name = "车队审核备注")
|
||||
private String motorcadeRejectReason;
|
||||
/** 车队队长userId */
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长账号")
|
||||
@Excel(name = "车队队长账号")
|
||||
private String motorcadeHeaderAccount;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 审核人员id */
|
||||
@ApiModelProperty("审核人员id")
|
||||
@Excel(name = "审核人员id")
|
||||
private Long checkPersonId;
|
||||
/** 审核人员名称 */
|
||||
@ApiModelProperty("审核人员名称")
|
||||
@Excel(name = "审核人员名称")
|
||||
private String checkPersonName;
|
||||
/** 审核时间 */
|
||||
@ApiModelProperty("审核时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkPersonTime;
|
||||
/** 车队状态(0-无状态,1-正常,2-解散,3-黑名单) */
|
||||
@ApiModelProperty("车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
@Excel(name = "车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
private Long motorcadeDissolutionStatus;
|
||||
|
||||
/** 黑名单备注 */
|
||||
@ApiModelProperty("黑名单备注")
|
||||
@Excel(name = "黑名单备注")
|
||||
private String blackListReason;
|
||||
|
||||
@ApiModelProperty(name = "承运商编码")
|
||||
private String driverEnterpriseCode;
|
||||
|
||||
@ApiModelProperty(value = "数据来源(1-数字物流 2-TMS)")
|
||||
private Integer dataSources;
|
||||
@ApiModelProperty(value = "是否默认车队(1-是 2-否)")
|
||||
private Integer defaultFlag;
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.user.domain.motorcade.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 车队司机记录对象 motorcade_record
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeDriver extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队司机表 */
|
||||
@ApiModelProperty("车队司机表")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeDriverId;
|
||||
/** 用户id */
|
||||
@ApiModelProperty("用户id")
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
|
||||
@ApiModelProperty(name = "tms推送状态: 1-未推送 2- 已推送")
|
||||
private Integer tmsPushStatus;
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.user.domain.motorcade.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 车队邀请记录对象 motorcade_record
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeRecord extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队邀请记录表 */
|
||||
@ApiModelProperty("车队邀请记录表")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeRecordId;
|
||||
/** 用户id */
|
||||
@ApiModelProperty("用户id")
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 车队认证状态(0.无状态1.已加入2.已拒绝3.已退出) */
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0=.无状态1.已加入2.已拒绝3.已退出")
|
||||
private Long motorcadeRecordStatus;
|
||||
/** 接受邀请时间/退出时间 */
|
||||
@ApiModelProperty("接受邀请时间/退出时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordTime;
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.mhd.user.domain.motorcade.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队司机Service接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeDriverRepositoryInterface extends IService<MotorcadeDriver>
|
||||
{
|
||||
|
||||
/**
|
||||
* 根据用户查询车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据车队id查询司机id
|
||||
*/
|
||||
public List<MotorcadeDriverPo> selectDriverIdByMotorcadeId(List<Long> motorcadeIds);
|
||||
|
||||
/**
|
||||
* 新增车队司机
|
||||
*/
|
||||
public Boolean insert(MotorcadeDriver motorcadeDriver);
|
||||
|
||||
/**
|
||||
* 批量删除车队司机
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeDriverIds);
|
||||
|
||||
/**
|
||||
* 批量新增车队司机
|
||||
*
|
||||
* @param list 车队司机集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAddMotorcadeDriver(List<MotorcadeDriver> list);
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.mhd.user.domain.motorcade.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队邀请记录Service接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeRecordRepositoryInterface extends IService<MotorcadeRecord>
|
||||
{
|
||||
/**
|
||||
* 分页查询车队邀请记录列表
|
||||
*/
|
||||
public List<MotorcadeRecordPo> queryList(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表(是否新邀请)
|
||||
*/
|
||||
public List<MotorcadeRecordPo> selectRecordList(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 新增车队邀请记录
|
||||
*/
|
||||
public Boolean insert(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 修改车队邀请记录
|
||||
*/
|
||||
public Boolean update(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 批量删除车队邀请记录
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeRecordIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录
|
||||
*/
|
||||
public MotorcadeRecordPo getInfo(Long motorcadeRecordId);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
List<MotorcadeDriverAppPo> invitationRecordList(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表 -PC
|
||||
*/
|
||||
List<MotorcadeRecordPo> invitationRecordListPC(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
List<MotorcadeRecord> getByMotorHeaderId(Long userId);
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.mhd.user.domain.motorcade.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队Service接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeRepositoryInterface extends IService<Motorcade>
|
||||
{
|
||||
/**
|
||||
* 分页查询车队列表
|
||||
*/
|
||||
public List<MotorcadePo> queryList(MotorcadeDO motorcadeDo);
|
||||
|
||||
/**
|
||||
* 查询我加入的所以车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdList(Long driverId);
|
||||
|
||||
/**
|
||||
* 新增车队
|
||||
*/
|
||||
public Motorcade insert(MotorcadeDO motorcadeDo);
|
||||
|
||||
/**
|
||||
* 修改车队
|
||||
*/
|
||||
public Boolean update(MotorcadeDO motorcadeDo);
|
||||
|
||||
/**
|
||||
* 批量删除车队
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询车队
|
||||
*/
|
||||
public MotorcadePo getInfo(Long motorcadeId);
|
||||
|
||||
/**
|
||||
* 根据车队长id,查询该车队长下所有司机信息
|
||||
* @param driverId
|
||||
* @return
|
||||
*/
|
||||
List<MotorcadeDriver> selectMotorcadeDriverByDriverId(Long driverId);
|
||||
|
||||
/**
|
||||
* APP查询当前用户车队列表信息
|
||||
* @param motorcadeDo
|
||||
* @return
|
||||
*/
|
||||
List<MotorcadeAppPo> queryMyMotorcadeList(MotorcadeDO motorcadeDo);
|
||||
|
||||
List<MotorcadeDriverPo> getDriverListById(MotorcadeDO motorcadeDo);
|
||||
|
||||
List<UserDriverPo> fleetInviteDriverList(MotorcadeDriverDO motorcadeDriverDO);
|
||||
|
||||
List<MotorcadePo> getAllOtherMotorcade(Long userId);
|
||||
|
||||
List<MotorcadePo> queryNonePagingList(Long organizationId);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.mhd.user.domain.motorcade.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队司机Mapper接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeDriverMapper extends BaseMapper<MotorcadeDriver>
|
||||
{
|
||||
|
||||
/**
|
||||
* 根据用户查询车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据车队id查询司机id
|
||||
*/
|
||||
public List<MotorcadeDriverPo> selectDriverIdByMotorcadeId(@Param("motorcadeIds") List<Long> motorcadeIds);
|
||||
|
||||
/**
|
||||
* 批量新增车队司机
|
||||
*
|
||||
* @param list 车队司机集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAddMotorcadeDriver(List<MotorcadeDriver> list);
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.mhd.user.domain.motorcade.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 车队Mapper接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeMapper extends BaseMapper<Motorcade>
|
||||
{
|
||||
/**
|
||||
* 查询车队列表
|
||||
*/
|
||||
public List<MotorcadePo> queryList(MotorcadeDO motorcadeDo);
|
||||
|
||||
List<MotorcadePo> queryNonePagingList(@Param("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 查询我加入的所以车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdList(Long driverId);
|
||||
|
||||
/**
|
||||
* 根据车队长id,查询该车队长下所有司机信息
|
||||
* @param driverId
|
||||
* @return
|
||||
*/
|
||||
List<MotorcadeDriver> selectMotorcadeDriverByDriverId(@Param("driverId") Long driverId);
|
||||
|
||||
/**
|
||||
* APP查询当前用户车队列表信息
|
||||
* @param motorcadeDo
|
||||
* @return
|
||||
*/
|
||||
List<MotorcadeAppPo> queryMyMotorcadeList(@Param("motorcadeDo") MotorcadeDO motorcadeDo);
|
||||
|
||||
/**
|
||||
* 根据车队Id查询司机列表
|
||||
* @param motorcadeDo
|
||||
* @return
|
||||
*/
|
||||
List<MotorcadeDriverPo> getDriverListById(@Param("motorcadeDo") MotorcadeDO motorcadeDo);
|
||||
|
||||
List<UserDriverPo> fleetInviteDriverList(@Param("motorcadeDriverDO") MotorcadeDriverDO motorcadeDriverDO);
|
||||
|
||||
@Select("SELECT m.* FROM `motorcade_driver` md LEFT JOIN motorcade m ON md.motorcade_id = m.motorcade_id WHERE md.del_flag = 1 AND m.del_flag = 1 AND md.user_id = #{userId} AND m.motorcade_header_id != #{userId}")
|
||||
List<MotorcadePo> getAllOtherMotorcade(@Param("userId") Long userId);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.mhd.user.domain.motorcade.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 车队邀请记录Mapper接口
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
public interface MotorcadeRecordMapper extends BaseMapper<MotorcadeRecord>
|
||||
{
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
public List<MotorcadeRecordPo> queryList(@Param("motorcadeRecordDo") MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表(是否新邀请)
|
||||
*/
|
||||
public List<MotorcadeRecordPo> selectRecordList(MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
List<MotorcadeDriverAppPo> invitationRecordList(@Param("motorcadeRecordDo")MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表 - PC
|
||||
*/
|
||||
List<MotorcadeRecordPo> invitationRecordListPC(@Param("motorcadeRecordDo")MotorcadeRecordDO motorcadeRecordDo);
|
||||
|
||||
@Select("SELECT * FROM `motorcade_record` WHERE del_flag = 1 AND motorcade_id IN (SELECT motorcade_id FROM motorcade WHERE del_flag = 1 and motorcade_header_id = #{userId})")
|
||||
List<MotorcadeRecord> getByMotorHeaderId(@Param("userId") Long userId);
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.mhd.user.domain.motorcade.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeDriverRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeRecordRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.mapper.MotorcadeDriverMapper;
|
||||
import com.mhd.user.domain.motorcade.repository.mapper.MotorcadeRecordMapper;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
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 zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
public class MotorcadeDriverRepositoryImpl extends ServiceImpl<MotorcadeDriverMapper, MotorcadeDriver> implements MotorcadeDriverRepositoryInterface {
|
||||
|
||||
@Autowired
|
||||
private MotorcadeDriverMapper motorcadeDriverMapper;
|
||||
|
||||
/**
|
||||
* 根据用户查询车队id
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectMotorcadeIdByUserId(Long userId){
|
||||
return motorcadeDriverMapper.selectMotorcadeIdByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id查询司机id
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeDriverPo> selectDriverIdByMotorcadeId(List<Long> motorcadeIds){
|
||||
return motorcadeDriverMapper.selectDriverIdByMotorcadeId(motorcadeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车队司机
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(MotorcadeDriver motorcadeDriver) {
|
||||
return this.save(motorcadeDriver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队司机
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] motorcadeDriverIds ) {
|
||||
List<MotorcadeDriver> list = new ArrayList<>();
|
||||
for (Long id : motorcadeDriverIds) {
|
||||
MotorcadeDriver motorcadeDriver = new MotorcadeDriver();
|
||||
motorcadeDriver.setMotorcadeDriverId(id);
|
||||
motorcadeDriver.setDelFlag(2);
|
||||
list.add(motorcadeDriver);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增车队司机
|
||||
*
|
||||
* @param list 车队司机集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchAddMotorcadeDriver(List<MotorcadeDriver> list){
|
||||
return motorcadeDriverMapper.batchAddMotorcadeDriver(list);
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.mhd.user.domain.motorcade.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeRecordRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.mapper.MotorcadeRecordMapper;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队邀请记录Service业务层处理
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
public class MotorcadeRecordRepositoryImpl extends ServiceImpl<MotorcadeRecordMapper, MotorcadeRecord> implements MotorcadeRecordRepositoryInterface {
|
||||
@Autowired
|
||||
private MotorcadeRecordMapper motorcadeRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeRecordPo> queryList(MotorcadeRecordDO motorcadeRecordDo)
|
||||
{
|
||||
return motorcadeRecordMapper.queryList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表(是否新邀请)
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeRecordPo> selectRecordList(MotorcadeRecordDO motorcadeRecordDo){
|
||||
return motorcadeRecordMapper.selectRecordList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车队邀请记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
MotorcadeRecord motorcadeRecord = new MotorcadeRecord();
|
||||
BeanUtils.copyProperties(motorcadeRecordDo,motorcadeRecord);
|
||||
return this.save(motorcadeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队邀请记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
MotorcadeRecord motorcadeRecord = new MotorcadeRecord();
|
||||
BeanUtils.copyProperties(motorcadeRecordDo,motorcadeRecord);
|
||||
return this.updateById(motorcadeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队邀请记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] motorcadeRecordIds ) {
|
||||
List<MotorcadeRecord> list = new ArrayList<>();
|
||||
for (Long id : motorcadeRecordIds) {
|
||||
MotorcadeRecord motorcadeRecord = new MotorcadeRecord();
|
||||
motorcadeRecord.setMotorcadeRecordId(id);
|
||||
motorcadeRecord.setDelFlag(2);
|
||||
list.add(motorcadeRecord);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队邀请记录
|
||||
*/
|
||||
@Override
|
||||
public MotorcadeRecordPo getInfo(Long motorcadeRecordId) {
|
||||
LambdaQueryWrapper<MotorcadeRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeRecord::getMotorcadeRecordId,motorcadeRecordId);
|
||||
queryWrapper.eq(MotorcadeRecord::getDelFlag,1);
|
||||
MotorcadeRecord motorcadeRecord = this.getOne(queryWrapper);
|
||||
MotorcadeRecordPo motorcadeRecordPo = new MotorcadeRecordPo();
|
||||
if(null == motorcadeRecord){
|
||||
return null;
|
||||
}
|
||||
BeanUtils.copyProperties(motorcadeRecord,motorcadeRecordPo);
|
||||
return motorcadeRecordPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeDriverAppPo> invitationRecordList(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordMapper.invitationRecordList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表 - PC
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeRecordPo> invitationRecordListPC(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordMapper.invitationRecordListPC(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MotorcadeRecord> getByMotorHeaderId(Long userId) {
|
||||
return motorcadeRecordMapper.getByMotorHeaderId(userId);
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package com.mhd.user.domain.motorcade.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.mapper.MotorcadeMapper;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
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 zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
public class MotorcadeRepositoryImpl extends ServiceImpl<MotorcadeMapper, Motorcade> implements MotorcadeRepositoryInterface {
|
||||
@Autowired
|
||||
private MotorcadeMapper motorcadeMapper;
|
||||
|
||||
/**
|
||||
* 查询车队列表
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadePo> queryList(MotorcadeDO motorcadeDo)
|
||||
{
|
||||
return motorcadeMapper.queryList(motorcadeDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我加入的所以车队id
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectMotorcadeIdList(Long driverId){
|
||||
return motorcadeMapper.selectMotorcadeIdList(driverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车队
|
||||
*/
|
||||
@Override
|
||||
public Motorcade insert(MotorcadeDO motorcadeDo) {
|
||||
Motorcade motorcade = new Motorcade();
|
||||
BeanUtils.copyProperties(motorcadeDo,motorcade);
|
||||
this.save(motorcade);
|
||||
return motorcade;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(MotorcadeDO motorcadeDo) {
|
||||
Motorcade motorcade = new Motorcade();
|
||||
BeanUtils.copyProperties(motorcadeDo,motorcade);
|
||||
return this.updateById(motorcade);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] motorcadeIds ) {
|
||||
List<Motorcade> list = new ArrayList<>();
|
||||
for (Long id : motorcadeIds) {
|
||||
Motorcade motorcade = new Motorcade();
|
||||
motorcade.setMotorcadeId(id);
|
||||
motorcade.setDelFlag(2);
|
||||
list.add(motorcade);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队
|
||||
*/
|
||||
@Override
|
||||
public MotorcadePo getInfo(Long motorcadeId) {
|
||||
LambdaQueryWrapper<Motorcade> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Motorcade::getMotorcadeId,motorcadeId);
|
||||
queryWrapper.eq(Motorcade::getDelFlag,1);
|
||||
Motorcade motorcade = this.getOne(queryWrapper);
|
||||
MotorcadePo motorcadePo = new MotorcadePo();
|
||||
if(null != motorcade){
|
||||
BeanUtils.copyProperties(motorcade,motorcadePo);
|
||||
}
|
||||
return motorcadePo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MotorcadeDriver> selectMotorcadeDriverByDriverId(Long driverId) {
|
||||
return motorcadeMapper.selectMotorcadeDriverByDriverId(driverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP查询当前用户车队列表信息
|
||||
* @param motorcadeDo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeAppPo> queryMyMotorcadeList(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeMapper.queryMyMotorcadeList(motorcadeDo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MotorcadeDriverPo> getDriverListById(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeMapper.getDriverListById(motorcadeDo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDriverPo> fleetInviteDriverList(MotorcadeDriverDO motorcadeDriverDO) {
|
||||
return motorcadeMapper.fleetInviteDriverList(motorcadeDriverDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MotorcadePo> getAllOtherMotorcade(Long userId) {
|
||||
return motorcadeMapper.getAllOtherMotorcade(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MotorcadePo> queryNonePagingList(Long organizationId) {
|
||||
return motorcadeMapper.queryNonePagingList(organizationId);
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.mhd.user.domain.motorcade.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* APP车队对象 motorcade
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeAppPo extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeId;
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
@ApiModelProperty(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "组织名称")
|
||||
private String organizationName = "";
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName = "";
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
private String motorcadeImage = "";
|
||||
/** 车队长联系方式 */
|
||||
@ApiModelProperty("车队长联系方式")
|
||||
@Excel(name = "车队长联系方式")
|
||||
private String userPhone = "";
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion = "";
|
||||
/** 车队认证状态(1.正在审核2.认证成功3.认证失败) */
|
||||
@ApiModelProperty("车队认证状态(0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Long motorcadeStatus = 0L;
|
||||
@ApiModelProperty("车队审核备注")
|
||||
@Excel(name = "车队审核备注")
|
||||
private String motorcadeRejectReason = "";
|
||||
/** 车队队长userId */
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName = "";
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长账号")
|
||||
@Excel(name = "车队队长账号")
|
||||
private String motorcadeHeaderAccount = "";
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore = BigDecimal.ZERO;
|
||||
/** 审核人员id */
|
||||
@ApiModelProperty("审核人员id")
|
||||
@Excel(name = "审核人员id")
|
||||
private Long checkPersonId;
|
||||
/** 审核人员名称 */
|
||||
@ApiModelProperty("审核人员名称")
|
||||
@Excel(name = "审核人员名称")
|
||||
private String checkPersonName = "";
|
||||
/** 审核时间 */
|
||||
@ApiModelProperty("审核时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkPersonTime;
|
||||
/** 车队状态(0-无状态,1-正常,2-解散,3-黑名单) */
|
||||
@ApiModelProperty("车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
@Excel(name = "车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
private Long motorcadeDissolutionStatus;
|
||||
@ApiModelProperty("司机数")
|
||||
@Excel(name = "司机数")
|
||||
private Integer driverNum = 0;
|
||||
/** 车辆数 */
|
||||
@ApiModelProperty("车辆数")
|
||||
@Excel(name = "车辆数")
|
||||
private Integer vehicleNum = 0;
|
||||
/** 新的邀请数量 */
|
||||
@ApiModelProperty("新的邀请数量")
|
||||
@Excel(name = "新的邀请数量")
|
||||
private Integer invitationNum = 0;
|
||||
|
||||
|
||||
@ApiModelProperty("我的车队列表")
|
||||
@Excel(name = "我的车队列表")
|
||||
private List<MotorcadeAppPo> myMotorcadeList = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("我加入的车队列表")
|
||||
@Excel(name = "我加入的车队列表")
|
||||
private List<MotorcadeAppPo> joinMotorcadeList = new ArrayList<>();
|
||||
|
||||
/** 用户id */
|
||||
@ApiModelProperty("用户id")
|
||||
private String userIds = "";
|
||||
|
||||
/** 黑名单备注 */
|
||||
@ApiModelProperty("黑名单备注")
|
||||
@Excel(name = "黑名单备注")
|
||||
private String blackListReason;
|
||||
|
||||
@ApiModelProperty(value = "是否默认车队(1-是 2-否)")
|
||||
private Integer defaultFlag;
|
||||
|
||||
@ApiModelProperty(name = "是否签署代收协议(0-无状态,1-未签署,2-已签署)")
|
||||
private Integer contractStatus = 0;
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.mhd.user.domain.motorcade.repository.po;
|
||||
|
||||
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;
|
||||
|
||||
@Data
|
||||
public class MotorcadeDriverAppPo extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "用户主表ID")
|
||||
private Long userId = 0L;
|
||||
@ApiModelProperty(name = "手机号码")
|
||||
private String userPhone = "";
|
||||
@ApiModelProperty(name = "用户姓名(真实姓名)")
|
||||
private String userName = "";
|
||||
@ApiModelProperty(name = "用户头像")
|
||||
private String avatar="";
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehicleLicensePlateNumber = "";
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private Long vehicleId;
|
||||
@ApiModelProperty(name = "车辆类别:1-个人车辆 2-企业车辆")
|
||||
private Integer vehicleCategory;
|
||||
@ApiModelProperty(name = "车辆类型(数据字典id)")
|
||||
private String vehicleTypeId;
|
||||
@ApiModelProperty(name = "车辆类型(数据字典name)")
|
||||
private String vehicleTypeName;
|
||||
|
||||
@ApiModelProperty(name = "承运人个体司机认证状态:0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Integer driverFill = 1;
|
||||
@ApiModelProperty(name = "用户实名认证状态:0-无状态,1-已注册未认证,2-已认证待审核,3-审核通过,4-已驳回")
|
||||
private Integer userAuthStatus = 1;
|
||||
|
||||
/** 车队认证状态(0.无状态1.已加入2.已拒绝3.已退出) */
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
private Long motorcadeRecordStatus;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty(name = "运单量")
|
||||
private Integer waybillNum = 0;
|
||||
|
||||
@ApiModelProperty(name = "评分")
|
||||
private BigDecimal score = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty(name = "角色编码")
|
||||
private String roleCode;
|
||||
|
||||
@ApiModelProperty(name = "车队ID")
|
||||
private Long motorcadeId = 0L;
|
||||
|
||||
@ApiModelProperty(name = "运输企业id")
|
||||
private Long userDriverEnterpriseId = 0L;
|
||||
|
||||
@ApiModelProperty(name = "是否签署代收协议(0-无状态,1-未签署,2-已签署)")
|
||||
private Integer contractStatus = 0;
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.mhd.user.domain.motorcade.repository.po;
|
||||
|
||||
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;
|
||||
|
||||
@Data
|
||||
public class MotorcadeDriverPo extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "用户主表ID")
|
||||
private Long userId = 0L;
|
||||
@ApiModelProperty(name = "手机号码")
|
||||
private String userPhone = "";
|
||||
@ApiModelProperty(name = "用户姓名(真实姓名)")
|
||||
private String userName = "";
|
||||
@ApiModelProperty(name = "用户头像")
|
||||
private String avatar = "";
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehicleLicensePlateNumber = "";
|
||||
@ApiModelProperty(name = "车辆类别:1-个人车辆 2-企业车辆")
|
||||
private Integer vehicleCategory;
|
||||
@ApiModelProperty(name = "车辆类型(数据字典id)")
|
||||
private String vehicleTypeId;
|
||||
@ApiModelProperty(name = "车辆类型(数据字典name)")
|
||||
private String vehicleTypeName;
|
||||
|
||||
@ApiModelProperty(name = "承运人个体司机认证状态:0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Integer driverFill = 1;
|
||||
@ApiModelProperty(name = "用户实名认证状态:0-无状态,1-已注册未认证,2-已认证待审核,3-审核通过,4-已驳回")
|
||||
private Integer userAuthStatus = 1;
|
||||
|
||||
/**
|
||||
* 车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)
|
||||
*/
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
private Long motorcadeRecordStatus;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty(name = "运单量")
|
||||
private Integer waybillNum = 0;
|
||||
|
||||
@ApiModelProperty(name = "评分")
|
||||
private BigDecimal score = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehiclePlateNumbers;
|
||||
|
||||
@ApiModelProperty(name = "车辆总数")
|
||||
private Integer vehicleNum;
|
||||
|
||||
/** 用户账号 */
|
||||
@ApiModelProperty(name = "用户账号")
|
||||
private String userAccount;
|
||||
|
||||
@ApiModelProperty("代收款协议地址")
|
||||
private String agreementUrl;
|
||||
|
||||
@ApiModelProperty("司机类型:1-自有司机,2-挂靠")
|
||||
private Integer driverType;
|
||||
|
||||
@ApiModelProperty(name = "tms推送状态: 1-未推送 2- 已推送")
|
||||
private Integer tmsPushStatus;
|
||||
|
||||
@ApiModelProperty("流程id")
|
||||
private String fileId;
|
||||
|
||||
@ApiModelProperty("签署PDF地址")
|
||||
private String agreementUrlPdf;
|
||||
|
||||
@ApiModelProperty("合同状态:1.无状态,2-已填充模板,3-已发起签署,4-签署完毕")
|
||||
private Integer contractStatus;
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.mhd.user.domain.motorcade.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 车队对象 motorcade
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadePo extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeId;
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
@ApiModelProperty(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "组织名称")
|
||||
private String organizationName;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
@NeedSetValue
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队认证状态(1.正在审核2.认证成功3.认证失败) */
|
||||
@ApiModelProperty("车队认证状态(0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Long motorcadeStatus;
|
||||
@ApiModelProperty("车队审核备注")
|
||||
@Excel(name = "车队审核备注")
|
||||
private String motorcadeRejectReason = "";
|
||||
/** 车队队长userId */
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长账号")
|
||||
@Excel(name = "车队队长账号")
|
||||
private String motorcadeHeaderAccount;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 审核人员id */
|
||||
@ApiModelProperty("审核人员id")
|
||||
@Excel(name = "审核人员id")
|
||||
private Long checkPersonId;
|
||||
/** 审核人员名称 */
|
||||
@ApiModelProperty("审核人员名称")
|
||||
@Excel(name = "审核人员名称")
|
||||
private String checkPersonName;
|
||||
/** 审核时间 */
|
||||
@ApiModelProperty("审核时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkPersonTime;
|
||||
/** 车队状态(0-无状态,1-正常,2-解散,3-黑名单) */
|
||||
@ApiModelProperty("车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
@Excel(name = "车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
private Long motorcadeDissolutionStatus;
|
||||
@ApiModelProperty("司机数")
|
||||
@Excel(name = "司机数")
|
||||
private Integer driverNum;
|
||||
/** 车辆数 */
|
||||
@ApiModelProperty("车辆数")
|
||||
@Excel(name = "车辆数")
|
||||
private Integer vehicleNum;
|
||||
|
||||
/** 黑名单备注 */
|
||||
@ApiModelProperty("黑名单备注")
|
||||
@Excel(name = "黑名单备注")
|
||||
private String blackListReason;
|
||||
|
||||
@ApiModelProperty(name = "承运商编码")
|
||||
private String driverEnterpriseCode;
|
||||
|
||||
@ApiModelProperty(value = "数据来源(1-数字物流 2-TMS)")
|
||||
private Integer dataSources;
|
||||
|
||||
@ApiModelProperty(value = "是否默认车队(1-是 2-否)")
|
||||
private Integer defaultFlag;
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.mhd.user.domain.motorcade.repository.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.domain.po.VehiclePo;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 车队邀请记录对象 motorcade_record
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeRecordPo extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队邀请记录表 */
|
||||
@ApiModelProperty("车队邀请记录表")
|
||||
private Long motorcadeRecordId;
|
||||
/** 用户id */
|
||||
@ApiModelProperty("用户id")
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 车队认证状态(0.无状态1.已加入2.已拒绝3.已退出) */
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0=.无状态1.已加入2.已拒绝3.已退出")
|
||||
private Long motorcadeRecordStatus;
|
||||
/** 邀请时间 */
|
||||
@ApiModelProperty("接受邀请时间/退出时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "接受邀请时间/退出时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date recordTime;
|
||||
@ApiModelProperty(name = "车辆集合")
|
||||
private List<VehiclePo> vehicleList = null;
|
||||
@ApiModelProperty(name = "车辆map集合")
|
||||
private List<Map<String,String>> vehicleMapList = null;
|
||||
|
||||
@ApiModelProperty(name = "手机号码")
|
||||
private String userPhone;
|
||||
|
||||
@ApiModelProperty(name = "用户姓名(真实姓名)")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehicleLicensePlateNumber;
|
||||
|
||||
@ApiModelProperty("车辆ID")
|
||||
private String vehicleId;
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package com.mhd.user.domain.motorcade.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.UserDO;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车队对象 motorcade
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeDO extends UserDO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeId;
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
@ApiModelProperty(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "组织名称")
|
||||
private String organizationName;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
@NeedSetValue
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队认证状态(1.正在审核2.认证成功3.认证失败) */
|
||||
@ApiModelProperty("车队认证状态(0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Long motorcadeStatus;
|
||||
@ApiModelProperty("车队审核备注")
|
||||
@Excel(name = "车队审核备注")
|
||||
private String motorcadeRejectReason;
|
||||
/** 车队队长userId */
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长账号")
|
||||
@Excel(name = "车队队长账号")
|
||||
private String motorcadeHeaderAccount;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 审核人员id */
|
||||
@ApiModelProperty("审核人员id")
|
||||
@Excel(name = "审核人员id")
|
||||
private Long checkPersonId;
|
||||
/** 审核人员名称 */
|
||||
@ApiModelProperty("审核人员名称")
|
||||
@Excel(name = "审核人员名称")
|
||||
private String checkPersonName;
|
||||
/** 审核时间 */
|
||||
@ApiModelProperty("审核时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkPersonTime;
|
||||
/** 车队状态(0-无状态,1-正常,2-解散,3-黑名单) */
|
||||
@ApiModelProperty("车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
@Excel(name = "车队状态(0-无状态,1-正常,2-解散,3-黑名单)")
|
||||
private Long motorcadeDissolutionStatus;
|
||||
@ApiModelProperty(name = "车队id集合")
|
||||
private List<Long> motorcadeIds;
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty(name = "PC承运人车队长认证步骤(0-用户注册,1-提交认证资料)")
|
||||
private Integer stepFlagC;
|
||||
|
||||
@ApiModelProperty("关联车队用户id")
|
||||
@Excel(name = "关联车队用户id")
|
||||
private Long myMotorcadeUserId;
|
||||
|
||||
/** 黑名单备注 */
|
||||
@ApiModelProperty("黑名单备注")
|
||||
@Excel(name = "黑名单备注")
|
||||
private String blackListReason;
|
||||
|
||||
@ApiModelProperty(name = "承运商编码")
|
||||
private String driverEnterpriseCode;
|
||||
|
||||
@ApiModelProperty(value = "数据来源(1-数字物流 2-TMS)")
|
||||
private Integer dataSources;
|
||||
|
||||
@ApiModelProperty(value = "是否默认车队(1-是 2-否)")
|
||||
private Integer defaultFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建时间起")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTimeFrom;
|
||||
@ApiModelProperty(value = "创建时间止")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTimeTo;
|
||||
@ApiModelProperty(value = "审核时间起")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date userAuthTimeFrom;
|
||||
@ApiModelProperty(value = "审核时间止")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date userAuthTimeTo;
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.mhd.user.domain.motorcade.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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;
|
||||
|
||||
@Data
|
||||
public class MotorcadeDriverDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("车队id")
|
||||
private Long motorcadeId;
|
||||
|
||||
@ApiModelProperty(name = "用户主表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(name = "手机号码")
|
||||
private String userPhone;
|
||||
|
||||
@ApiModelProperty(name = "用户姓名(真实姓名)")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(name = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehicleLicensePlateNumber;
|
||||
|
||||
@ApiModelProperty(name = "车辆类别:1-个人车辆 2-企业车辆")
|
||||
private Integer vehicleCategory;
|
||||
|
||||
@ApiModelProperty(name = "车辆类型(数据字典id)")
|
||||
private String vehicleTypeId;
|
||||
|
||||
@ApiModelProperty(name = "车辆类型(数据字典name)")
|
||||
private String vehicleTypeName;
|
||||
|
||||
@ApiModelProperty(name = "承运人个体司机认证状态:0-无状态,1-未认证,2-正在审核,3-认证通过,4-认证失败,5-认证失效")
|
||||
private Integer driverFill;
|
||||
|
||||
@ApiModelProperty(name = "用户实名认证状态:0-无状态,1-已注册未认证,2-已认证待审核,3-审核通过,4-已驳回")
|
||||
private Integer userAuthStatus;
|
||||
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
private Long motorcadeRecordStatus;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty(name = "运单量")
|
||||
private Integer waybillNum;
|
||||
|
||||
@ApiModelProperty(name = "评分")
|
||||
private BigDecimal score;
|
||||
|
||||
@ApiModelProperty(name = "车牌号")
|
||||
private String vehiclePlateNumbers;
|
||||
|
||||
@ApiModelProperty(name = "车辆总数")
|
||||
private Integer vehicleNum;
|
||||
|
||||
@ApiModelProperty(name = "用户账号")
|
||||
private String userAccount;
|
||||
|
||||
@ApiModelProperty(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty(name = "tms推送状态: 1-未推送 2- 已推送")
|
||||
private Integer tmsPushStatus;
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.mhd.user.domain.motorcade.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车队邀请记录对象 motorcade_record
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeRecordDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车队邀请记录表 */
|
||||
@ApiModelProperty("车队邀请记录表")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeRecordId;
|
||||
/** 用户id */
|
||||
@ApiModelProperty("用户id")
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
/** 车队id */
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
/** 车队头像 */
|
||||
@ApiModelProperty("车队头像")
|
||||
@Excel(name = "车队头像")
|
||||
private String motorcadeImage;
|
||||
/** 车队介绍 */
|
||||
@ApiModelProperty("车队介绍")
|
||||
@Excel(name = "车队介绍")
|
||||
private String motorcadeDescribtion;
|
||||
/** 车队队长名称 */
|
||||
@ApiModelProperty("车队队长名称")
|
||||
@Excel(name = "车队队长名称")
|
||||
private String motorcadeHeaderName;
|
||||
/** 车队评分 */
|
||||
@ApiModelProperty("车队评分")
|
||||
@Excel(name = "车队评分")
|
||||
private BigDecimal motorcadeScore;
|
||||
/** 车队认证状态(0.无状态1.已加入2.已拒绝3.已退出) */
|
||||
@ApiModelProperty("车队认证状态(0.无状态1.已加入2.已拒绝3.已退出)")
|
||||
@Excel(name = "车队认证状态", readConverterExp = "0=.无状态1.已加入2.已拒绝3.已退出")
|
||||
private Long motorcadeRecordStatus;
|
||||
/** 邀请时间 */
|
||||
@ApiModelProperty("接受邀请时间/退出时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "接受邀请时间/退出时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date recordTime;
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
@ApiModelProperty(name = "是否新邀请")
|
||||
private Integer isNew;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "创建开始日期")
|
||||
private Date createStartTime;
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "创建结束日期")
|
||||
private Date createEndTime;
|
||||
|
||||
/** 车队名称 */
|
||||
@ApiModelProperty("司机信息")
|
||||
private String driverInfo;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
@Excel(name = "用户id")
|
||||
private String userIds;
|
||||
}
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
package com.mhd.user.domain.motorcade.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadePo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDO;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValueMethod;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeDriverDO;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDriverPo;
|
||||
import com.mhd.user.infrastructure.util.annotation.DataPermissions;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
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;
|
||||
/**
|
||||
* 车队
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeDomainService {
|
||||
|
||||
@Autowired
|
||||
private MotorcadeRepositoryInterface motorcadeInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车队列表
|
||||
*/
|
||||
@NeedSetValueMethod
|
||||
@DataPermissions(cacheName = "master")
|
||||
public List<MotorcadePo> queryList(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeInterface.queryList(motorcadeDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我加入的所以车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdList(Long driverId){
|
||||
return motorcadeInterface.selectMotorcadeIdList(driverId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车队
|
||||
*/
|
||||
public Motorcade insert(MotorcadeDO motorcadeDo) {
|
||||
|
||||
return motorcadeInterface.insert(motorcadeDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队
|
||||
*/
|
||||
public Boolean update(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeInterface.update(motorcadeDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeIds) {
|
||||
return motorcadeInterface.delete(motorcadeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车队详细信息
|
||||
*/
|
||||
public MotorcadePo getInfo(Long motorcadeId)
|
||||
{
|
||||
return motorcadeInterface.getInfo(motorcadeId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据司机id查询司机名下车队信息
|
||||
* @param driverId
|
||||
* @return
|
||||
*/
|
||||
public List<Motorcade> selectMotorcadeByDriverId(Long driverId) {
|
||||
return motorcadeInterface.getBaseMapper().selectList(new QueryWrapper<Motorcade>()
|
||||
.lambda().eq(Motorcade::getMotorcadeHeaderId,driverId).eq(Motorcade::getDelFlag,1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队长id,查询该车队长下所有司机信息
|
||||
* @param driverId
|
||||
* @return
|
||||
*/
|
||||
public List<MotorcadeDriver> selectMotorcadeDriverByDriverId(Long driverId) {
|
||||
return motorcadeInterface.selectMotorcadeDriverByDriverId(driverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP查询当前用户车队列表信息
|
||||
* @param motorcadeDo
|
||||
* @return
|
||||
*/
|
||||
public List<MotorcadeAppPo> queryMyMotorcadeList(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeInterface.queryMyMotorcadeList(motorcadeDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据lambda查询单条数据
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
public Motorcade selectOneByLambda(LambdaQueryWrapper<Motorcade> queryWrapper) {
|
||||
return motorcadeInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public Boolean updateBatchById(List<Motorcade> ids) {
|
||||
return motorcadeInterface.updateBatchById(ids);
|
||||
}
|
||||
|
||||
public List<Motorcade> selectListByIds(List<Long> motorcadeIds) {
|
||||
|
||||
return motorcadeInterface
|
||||
.lambdaQuery()
|
||||
.eq(Motorcade::getDelFlag,1)
|
||||
.in(Motorcade::getMotorcadeId,motorcadeIds)
|
||||
.list();
|
||||
}
|
||||
|
||||
public List<MotorcadeDriverPo> getDriverListById(MotorcadeDO motorcadeDo) {
|
||||
return motorcadeInterface.getDriverListById(motorcadeDo);
|
||||
}
|
||||
|
||||
public Boolean deletePC(List<Long> motorcadeIds) {
|
||||
List<Motorcade> ids = new ArrayList<>();
|
||||
for (Long id : motorcadeIds) {
|
||||
Motorcade motorcade = new Motorcade();
|
||||
motorcade.setMotorcadeId(id);
|
||||
motorcade.setDelFlag(2);
|
||||
ids.add(motorcade);
|
||||
}
|
||||
return motorcadeInterface.updateBatchById(ids);
|
||||
|
||||
}
|
||||
|
||||
public Motorcade getInfoByOpen(String driverEnterpriseCode, Integer dataSources) {
|
||||
return motorcadeInterface
|
||||
.lambdaQuery()
|
||||
.eq(Motorcade::getDelFlag,1)
|
||||
.eq(Motorcade::getDriverEnterpriseCode,driverEnterpriseCode)
|
||||
.eq(Motorcade::getDataSources,dataSources)
|
||||
.one();
|
||||
}
|
||||
|
||||
public boolean saveOrUpdate(Motorcade motorcade) {
|
||||
return motorcadeInterface.saveOrUpdate(motorcade);
|
||||
}
|
||||
|
||||
public List<UserDriverPo> fleetInviteDriverList(MotorcadeDriverDO motorcadeDriverDO) {
|
||||
return motorcadeInterface.fleetInviteDriverList(motorcadeDriverDO);
|
||||
}
|
||||
|
||||
public Motorcade getDefaultMotorcade() {
|
||||
return motorcadeInterface
|
||||
.lambdaQuery()
|
||||
.eq(Motorcade::getDelFlag,1)
|
||||
.eq(Motorcade::getDefaultFlag,1)
|
||||
.eq(Motorcade::getMotorcadeStatus,3)
|
||||
.one();
|
||||
}
|
||||
|
||||
public List<MotorcadePo> getAllOtherMotorcade(Long userId) {
|
||||
return motorcadeInterface.getAllOtherMotorcade(userId);
|
||||
}
|
||||
|
||||
|
||||
public List<MotorcadePo> queryNonePagingList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null &&loginUser.getUserPo().getTopOrganizationId()!= null){
|
||||
return motorcadeInterface.queryNonePagingList(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package com.mhd.user.domain.motorcade.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeDriver;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeDriverRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverPo;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserEntity;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 车队司机
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeDriverDomainService {
|
||||
|
||||
@Autowired
|
||||
private MotorcadeDriverRepositoryInterface motorcadeDriverInterface;
|
||||
|
||||
/**
|
||||
* 根据用户查询车队id
|
||||
*/
|
||||
public List<Long> selectMotorcadeIdByUserId(Long userId){
|
||||
return motorcadeDriverInterface.selectMotorcadeIdByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id查询司机id
|
||||
*/
|
||||
public List<MotorcadeDriverPo> selectDriverIdByMotorcadeId(List<Long> motorcadeIds){
|
||||
return motorcadeDriverInterface.selectDriverIdByMotorcadeId(motorcadeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id查询司机id
|
||||
*/
|
||||
public List<Long> selectDriverIdByMotorcadeId(Long motorcadeId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaQuery()
|
||||
.select(MotorcadeDriver::getUserId)
|
||||
.eq(MotorcadeDriver::getMotorcadeId, motorcadeId)
|
||||
.eq(MotorcadeDriver::getDelFlag, 1)
|
||||
.list()
|
||||
.stream()
|
||||
.map(MotorcadeDriver::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车队司机
|
||||
*/
|
||||
public Boolean insert(MotorcadeDriver motorcadeDriver) {
|
||||
|
||||
return motorcadeDriverInterface.insert(motorcadeDriver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队司机
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeDriverIds) {
|
||||
return motorcadeDriverInterface.delete(motorcadeDriverIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增车队司机
|
||||
*
|
||||
* @param list 车队司机集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAddMotorcadeDriver(List<MotorcadeDriver> list){
|
||||
return motorcadeDriverInterface.batchAddMotorcadeDriver(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id删除关联关系
|
||||
* @param motorcadeId
|
||||
* @return
|
||||
*/
|
||||
public Boolean removeByMotorcadeId(Long motorcadeId) {
|
||||
//判断是否有绑定关系
|
||||
LambdaUpdateWrapper<MotorcadeDriver> queryWrapper = new LambdaUpdateWrapper<>();
|
||||
queryWrapper.set(MotorcadeDriver::getDelFlag,2);
|
||||
|
||||
queryWrapper.eq(MotorcadeDriver::getMotorcadeId,motorcadeId);
|
||||
return motorcadeDriverInterface.update(queryWrapper);
|
||||
}
|
||||
|
||||
public MotorcadeDriver selectByLambda(LambdaQueryWrapper<MotorcadeDriver> queryWrapper) {
|
||||
return motorcadeDriverInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据lambda表达式更新
|
||||
* @param updateWrapper
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateByLambda(LambdaUpdateWrapper<MotorcadeDriver> updateWrapper) {
|
||||
return motorcadeDriverInterface.update(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机退出车队
|
||||
* 根据车队和司机,移除绑定关系
|
||||
* @param motorcadeId
|
||||
* @param userid
|
||||
*/
|
||||
public Boolean removeByMotorcadeIdAndUserId(Long motorcadeId, Long userid) {
|
||||
//删除车队司机关系
|
||||
LambdaQueryWrapper<MotorcadeDriver> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeDriver::getMotorcadeId,motorcadeId);
|
||||
queryWrapper.eq(MotorcadeDriver::getUserId,userid);
|
||||
queryWrapper.eq(MotorcadeDriver::getDelFlag,1);
|
||||
|
||||
return motorcadeDriverInterface.remove(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userId获取加入车队数量
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public Integer getMotorcadeSumByUserId(Long userId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaQuery()
|
||||
.eq(MotorcadeDriver::getUserId, userId)
|
||||
.eq(MotorcadeDriver::getDelFlag, 1)
|
||||
.count();
|
||||
}
|
||||
|
||||
public MotorcadeDriver getInfoByDriveId(Long motorcadeId, Long userId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaQuery()
|
||||
.eq(MotorcadeDriver::getMotorcadeId, motorcadeId)
|
||||
.eq(MotorcadeDriver::getUserId, userId)
|
||||
.eq(MotorcadeDriver::getDelFlag, 1)
|
||||
.one();
|
||||
}
|
||||
|
||||
public List<MotorcadeDriver> getListByMotorcadeId(Long motorcadeId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaQuery()
|
||||
.eq(MotorcadeDriver::getMotorcadeId, motorcadeId)
|
||||
.eq(MotorcadeDriver::getDelFlag, 1)
|
||||
.list();
|
||||
}
|
||||
|
||||
public List<MotorcadeDriver> getListByDriveId(Long userId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaQuery()
|
||||
.eq(MotorcadeDriver::getUserId, userId)
|
||||
.eq(MotorcadeDriver::getDelFlag, 1)
|
||||
.list();
|
||||
}
|
||||
|
||||
public boolean deleteByMotorcadeIdAndUserId(Long motorcadeId, Long userId) {
|
||||
return motorcadeDriverInterface
|
||||
.lambdaUpdate()
|
||||
.set(MotorcadeDriver::getDelFlag, 2)
|
||||
.eq(ObjectUtil.isNotNull(motorcadeId), MotorcadeDriver::getMotorcadeId, motorcadeId)
|
||||
.eq(MotorcadeDriver::getUserId, userId)
|
||||
.update();
|
||||
}
|
||||
|
||||
public MotorcadeDriver selectOneByLambda(LambdaQueryWrapper<MotorcadeDriver> queryWrapper) {
|
||||
return motorcadeDriverInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public boolean updateById(MotorcadeDriver motorcadeDriver) {
|
||||
return motorcadeDriverInterface.updateById(motorcadeDriver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量修改实体
|
||||
* @author ZhouGY
|
||||
* @date 2024/6/24 15:18
|
||||
* @param motorcadeDriverList
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean batchUpdateByIds(List<MotorcadeDriver> motorcadeDriverList){
|
||||
return motorcadeDriverInterface.updateBatchById(motorcadeDriverList);
|
||||
}
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package com.mhd.user.domain.motorcade.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.mhd.user.domain.motorcade.entity.Motorcade;
|
||||
import com.mhd.user.domain.motorcade.entity.MotorcadeRecord;
|
||||
import com.mhd.user.domain.motorcade.repository.facade.MotorcadeRecordRepositoryInterface;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeDriverAppPo;
|
||||
import com.mhd.user.domain.motorcade.repository.po.MotorcadeRecordPo;
|
||||
import com.mhd.user.domain.motorcade.repository.todo.MotorcadeRecordDO;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 车队邀请记录
|
||||
*
|
||||
* @author zihao
|
||||
* @date 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeRecordDomainService {
|
||||
|
||||
@Autowired
|
||||
private MotorcadeRecordRepositoryInterface motorcadeRecordInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车队邀请记录列表
|
||||
*/
|
||||
public List<MotorcadeRecordPo> queryList(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordInterface.queryList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表(是否新邀请)
|
||||
*/
|
||||
public List<MotorcadeRecordPo> selectRecordList(MotorcadeRecordDO motorcadeRecordDo){
|
||||
return motorcadeRecordInterface.selectRecordList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增车队邀请记录
|
||||
*/
|
||||
public Boolean insert(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
|
||||
return motorcadeRecordInterface.insert(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队邀请记录
|
||||
*/
|
||||
public Boolean update(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordInterface.update(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
public Boolean updateById(MotorcadeRecord motorcadeRecord) {
|
||||
return motorcadeRecordInterface.updateById(motorcadeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队邀请记录
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeRecordIds) {
|
||||
return motorcadeRecordInterface.delete(motorcadeRecordIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车队邀请记录详细信息
|
||||
*/
|
||||
public MotorcadeRecordPo getInfo(Long motorcadeRecordId)
|
||||
{
|
||||
return motorcadeRecordInterface.getInfo(motorcadeRecordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表
|
||||
*/
|
||||
public List<MotorcadeDriverAppPo> invitationRecordList(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordInterface.invitationRecordList(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车队邀请记录列表 - PC
|
||||
*/
|
||||
public List<MotorcadeRecordPo> invitationRecordListPC(MotorcadeRecordDO motorcadeRecordDo) {
|
||||
return motorcadeRecordInterface.invitationRecordListPC(motorcadeRecordDo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据lambda表达式查询
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
public List<MotorcadeRecord> selectByLambda(LambdaQueryWrapper<MotorcadeRecord> query) {
|
||||
return motorcadeRecordInterface.list(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出车队
|
||||
* @param motorcadeId
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public Boolean exitMotorcade(Long motorcadeId, Long userid) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//修改该用户在该车队下的邀请记录(已加入),改为已退出
|
||||
LambdaUpdateWrapper<MotorcadeRecord> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(MotorcadeRecord::getMotorcadeId,motorcadeId);
|
||||
updateWrapper.eq(MotorcadeRecord::getUserId,userid);
|
||||
updateWrapper.eq(MotorcadeRecord::getMotorcadeRecordStatus,1);
|
||||
updateWrapper.eq(MotorcadeRecord::getDelFlag,1);
|
||||
|
||||
updateWrapper.set(MotorcadeRecord::getMotorcadeRecordStatus,3);
|
||||
updateWrapper.set(MotorcadeRecord::getRecordTime,new Date());
|
||||
updateWrapper.set(MotorcadeRecord::getUpdateBy,loginUser.getUserid());
|
||||
updateWrapper.set(MotorcadeRecord::getUpdateByName,loginUser.getUsername());
|
||||
updateWrapper.set(MotorcadeRecord::getUpdateTime,new Date());
|
||||
|
||||
return motorcadeRecordInterface.update(updateWrapper);
|
||||
}
|
||||
|
||||
public MotorcadeRecord save(MotorcadeRecordDO motorcadeRecordDO) {
|
||||
MotorcadeRecord motorcadeRecord = new MotorcadeRecord();
|
||||
BeanUtils.copyProperties(motorcadeRecordDO,motorcadeRecord);
|
||||
motorcadeRecordInterface.save(motorcadeRecord);
|
||||
motorcadeRecordDO.setMotorcadeRecordId(motorcadeRecord.getMotorcadeRecordId());
|
||||
return motorcadeRecord;
|
||||
}
|
||||
|
||||
public MotorcadeRecord selectOneByLambda(LambdaQueryWrapper<MotorcadeRecord> queryWrapper) {
|
||||
return motorcadeRecordInterface.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public List<MotorcadeRecord> getByMotorHeaderId(Long userId) {
|
||||
return motorcadeRecordInterface.getByMotorHeaderId(userId);
|
||||
}
|
||||
|
||||
public void updateBatchById(List<MotorcadeRecord> moList) {
|
||||
motorcadeRecordInterface.updateBatchById(moList);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车队代收协议对象 motorcade_collection
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeCollection extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("车队代收款协议表id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long motorcadeCollectionId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty("签订协议司机用户id")
|
||||
@Excel(name = "签订协议司机用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("代收款协议地址")
|
||||
@Excel(name = "代收款协议地址")
|
||||
private String agreementUrl;
|
||||
|
||||
@ApiModelProperty("合同编号")
|
||||
private String contractNo;
|
||||
|
||||
@ApiModelProperty("流程id")
|
||||
private String flowId;
|
||||
|
||||
@ApiModelProperty("流程id")
|
||||
private String fileId;
|
||||
|
||||
@ApiModelProperty("签署PDF地址")
|
||||
private String agreementUrlPdf;
|
||||
|
||||
@ApiModelProperty("合同状态:1.无状态,2-已填充模板,3-已发起签署,4-签署完毕")
|
||||
private Integer contractStatus;
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车队代收协议Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
public interface IMotorcadeCollectionService extends IService<MotorcadeCollection>
|
||||
{
|
||||
/**
|
||||
* 分页查询车队代收协议列表
|
||||
*/
|
||||
public List<MotorcadeCollectionPO> queryList(MotorcadeCollectionDO motorcadeCollectionDO);
|
||||
|
||||
/**
|
||||
* 新增车队代收协议
|
||||
*/
|
||||
public Boolean insert(MotorcadeCollectionDO motorcadeCollectionDO);
|
||||
|
||||
/**
|
||||
* 修改车队代收协议
|
||||
*/
|
||||
public Boolean update(MotorcadeCollectionDO motorcadeCollectionDO);
|
||||
|
||||
/**
|
||||
* 批量删除车队代收协议
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeCollectionIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询车队代收协议
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfo(Long motorcadeCollectionId);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 车队代收协议Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
public interface MotorcadeCollectionMapper extends BaseMapper<MotorcadeCollection>
|
||||
{
|
||||
/**
|
||||
* 查询车队代收协议列表
|
||||
*/
|
||||
public List<MotorcadeCollectionPO> queryList(MotorcadeCollectionDO motorcadeCollectionDO);
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.facade.IMotorcadeCollectionService;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.mapper.MotorcadeCollectionMapper;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
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-03-20
|
||||
*/
|
||||
@Service
|
||||
public class MotorcadeCollectionImpl extends ServiceImpl<MotorcadeCollectionMapper, MotorcadeCollection> implements IMotorcadeCollectionService{
|
||||
@Autowired
|
||||
private MotorcadeCollectionMapper motorcadeCollectionMapper;
|
||||
|
||||
/**
|
||||
* 查询车队代收协议列表
|
||||
*/
|
||||
@Override
|
||||
public List<MotorcadeCollectionPO> queryList(MotorcadeCollectionDO motorcadeCollectionDO)
|
||||
{
|
||||
return motorcadeCollectionMapper.queryList(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车队代收协议
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
MotorcadeCollection motorcadeCollection = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,motorcadeCollection);
|
||||
return this.save(motorcadeCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队代收协议
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
MotorcadeCollection motorcadeCollection = new MotorcadeCollection();
|
||||
BeanUtils.copyProperties(motorcadeCollectionDO,motorcadeCollection);
|
||||
return this.updateById(motorcadeCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队代收协议
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] motorcadeCollectionIds ) {
|
||||
List<MotorcadeCollection> list = new ArrayList<>();
|
||||
for (Long id : motorcadeCollectionIds) {
|
||||
MotorcadeCollection motorcadeCollection = new MotorcadeCollection();
|
||||
motorcadeCollection.setMotorcadeCollectionId(id);
|
||||
motorcadeCollection.setDelFlag(2);
|
||||
list.add(motorcadeCollection);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队代收协议
|
||||
*/
|
||||
@Override
|
||||
public MotorcadeCollectionPO getInfo(Long motorcadeCollectionId) {
|
||||
MotorcadeCollection motorcadeCollection = this.getById(motorcadeCollectionId);
|
||||
MotorcadeCollectionPO motorcadeCollectionPO = new MotorcadeCollectionPO();
|
||||
BeanUtils.copyProperties(motorcadeCollection,motorcadeCollectionPO);
|
||||
return motorcadeCollectionPO;
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车队代收协议对象 motorcade_collection
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "车队代收协议对象", description = "车队代收协议响应对象")
|
||||
public class MotorcadeCollectionPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("车队代收款协议表id")
|
||||
private Long motorcadeCollectionId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty("签订协议司机用户id")
|
||||
@Excel(name = "签订协议司机用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("代收款协议地址")
|
||||
@Excel(name = "代收款协议地址")
|
||||
private String agreementUrl;
|
||||
|
||||
@ApiModelProperty("合同编号")
|
||||
private String contractNo;
|
||||
|
||||
@ApiModelProperty("流程id")
|
||||
private String flowId;
|
||||
|
||||
@ApiModelProperty("合同状态:1.无状态,2-已填充模板,3-已发起签署,4-签署完毕")
|
||||
private Integer contractStatus;
|
||||
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.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;
|
||||
|
||||
|
||||
/**
|
||||
* 车队代收协议对象 motorcade_collection
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MotorcadeCollectionDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("车队代收款协议表id")
|
||||
private Long motorcadeCollectionId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织表name")
|
||||
@Excel(name = "组织表name")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("车队id")
|
||||
@Excel(name = "车队id")
|
||||
private Long motorcadeId;
|
||||
|
||||
@ApiModelProperty("车队名称")
|
||||
@Excel(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
|
||||
@ApiModelProperty("车队队长userId")
|
||||
@Excel(name = "车队队长userId")
|
||||
private Long motorcadeHeaderId;
|
||||
|
||||
@ApiModelProperty("签订协议司机用户id")
|
||||
@Excel(name = "签订协议司机用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("代收款协议地址")
|
||||
@Excel(name = "代收款协议地址")
|
||||
private String agreementUrl;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("合同编号")
|
||||
private String contractNo;
|
||||
|
||||
@ApiModelProperty("流程id")
|
||||
private String flowId;
|
||||
|
||||
@ApiModelProperty("合同状态:1.无状态,2-已填充模板,3-已发起签署,4-签署完毕")
|
||||
private Integer contractStatus;
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.mhd.user.domain.motorcadeCollection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.user.domain.motorcadeCollection.entity.MotorcadeCollection;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.facade.IMotorcadeCollectionService;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.po.MotorcadeCollectionPO;
|
||||
import com.mhd.user.domain.motorcadeCollection.repository.todo.MotorcadeCollectionDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 车队代收协议
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-03-20
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MotorcadeCollectionDomainService {
|
||||
|
||||
@Autowired
|
||||
private IMotorcadeCollectionService motorcadeCollectionService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询车队代收协议列表
|
||||
*/
|
||||
public List<MotorcadeCollectionPO> queryList(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
return motorcadeCollectionService.queryList(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增车队代收协议
|
||||
*/
|
||||
public Boolean insert(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
|
||||
return motorcadeCollectionService.insert(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车队代收协议
|
||||
*/
|
||||
public Boolean update(MotorcadeCollectionDO motorcadeCollectionDO) {
|
||||
return motorcadeCollectionService.update(motorcadeCollectionDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车队代收协议
|
||||
*/
|
||||
public Boolean delete(Long[] motorcadeCollectionIds) {
|
||||
return motorcadeCollectionService.delete(motorcadeCollectionIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车队代收协议详细信息
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfo(Long motorcadeCollectionId)
|
||||
{
|
||||
return motorcadeCollectionService.getInfo(motorcadeCollectionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id和用户id查询代收款协议
|
||||
* @param motorcadeId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public MotorcadeCollection selectByUserAndMotor(Long motorcadeId, Long userId) {
|
||||
LambdaQueryWrapper<MotorcadeCollection> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeCollection::getMotorcadeId,motorcadeId);
|
||||
queryWrapper.eq(MotorcadeCollection::getUserId,userId);
|
||||
queryWrapper.eq(MotorcadeCollection::getDelFlag,1);
|
||||
return motorcadeCollectionService.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public boolean saveOrUpdate(MotorcadeCollection motorcadeCollection) {
|
||||
return motorcadeCollectionService.saveOrUpdate(motorcadeCollection);
|
||||
}
|
||||
|
||||
public MotorcadeCollection selectByFlowId(String flowId) {
|
||||
LambdaQueryWrapper<MotorcadeCollection> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeCollection::getFlowId,flowId);
|
||||
return motorcadeCollectionService.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队id和用户id查询代收款协议
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfoByMoIdAndUserId(Long motorcadeId, Long userId) {
|
||||
MotorcadeCollectionPO motorcadeCollectionPO = new MotorcadeCollectionPO();
|
||||
LambdaQueryWrapper<MotorcadeCollection> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeCollection::getMotorcadeId,motorcadeId);
|
||||
queryWrapper.eq(MotorcadeCollection::getUserId,userId);
|
||||
queryWrapper.eq(MotorcadeCollection::getDelFlag,1);
|
||||
List<MotorcadeCollection> motorcadeCollections = motorcadeCollectionService.list(queryWrapper);
|
||||
if(motorcadeCollections != null && motorcadeCollections.size()>0){
|
||||
motorcadeCollections.stream().findFirst().ifPresent(motorcadeCollection -> BeanUtils.copyProperties(motorcadeCollection, motorcadeCollectionPO));
|
||||
return motorcadeCollectionPO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车队长userId和司机userId查询代收协议
|
||||
*/
|
||||
public MotorcadeCollectionPO getInfoByUserIds(Long motorcadeHeaderId, Long userId) {
|
||||
MotorcadeCollectionPO motorcadeCollectionPO = new MotorcadeCollectionPO();
|
||||
LambdaQueryWrapper<MotorcadeCollection> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MotorcadeCollection::getMotorcadeHeaderId,motorcadeHeaderId);
|
||||
queryWrapper.eq(MotorcadeCollection::getUserId,userId);
|
||||
queryWrapper.eq(MotorcadeCollection::getDelFlag,1);
|
||||
List<MotorcadeCollection> motorcadeCollections = motorcadeCollectionService.list(queryWrapper);
|
||||
if(motorcadeCollections != null && motorcadeCollections.size()>0){
|
||||
motorcadeCollections.stream().findFirst().ifPresent(motorcadeCollection -> BeanUtils.copyProperties(motorcadeCollection, motorcadeCollectionPO));
|
||||
return motorcadeCollectionPO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mhd.user.domain.projectUser.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;
|
||||
|
||||
|
||||
/**
|
||||
* 项目-用户关联对象 project_user
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ProjectUser extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("项目用户关联表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long projectUserId;
|
||||
|
||||
@ApiModelProperty("项目表ID")
|
||||
@Excel(name = "项目表ID")
|
||||
private Long projectManagementId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("用户表名称")
|
||||
@Excel(name = "用户表名称")
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.mhd.user.domain.projectUser.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.projectUser.entity.ProjectUser;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目-用户关联Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
public interface IProjectUserService extends IService<ProjectUser>
|
||||
{
|
||||
/**
|
||||
* 分页查询项目-用户关联列表
|
||||
*/
|
||||
public List<ProjectUserPO> queryList(ProjectUserDO projectUserDO);
|
||||
|
||||
/**
|
||||
* 新增项目-用户关联
|
||||
*/
|
||||
public Boolean insert(ProjectUserDO projectUserDO);
|
||||
|
||||
/**
|
||||
* 修改项目-用户关联
|
||||
*/
|
||||
public Boolean update(ProjectUserDO projectUserDO);
|
||||
|
||||
/**
|
||||
* 批量删除项目-用户关联
|
||||
*/
|
||||
public Boolean delete(Long[] projectUserIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询项目-用户关联
|
||||
*/
|
||||
public ProjectUserPO getInfo(Long projectUserId);
|
||||
|
||||
void deleteByProjectAccount(ProjectUserDO projectUserDO);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.user.domain.projectUser.repository.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.user.domain.projectUser.entity.ProjectUser;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO;
|
||||
|
||||
/**
|
||||
* 项目-用户关联Mapper接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
public interface ProjectUserMapper extends BaseMapper<ProjectUser>
|
||||
{
|
||||
/**
|
||||
* 查询项目-用户关联列表
|
||||
*/
|
||||
public List<ProjectUserPO> queryList(ProjectUserDO projectUserDO);
|
||||
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.mhd.user.domain.projectUser.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.user.domain.projectUser.entity.ProjectUser;
|
||||
import com.mhd.user.domain.projectUser.repository.facade.IProjectUserService;
|
||||
import com.mhd.user.domain.projectUser.repository.mapper.ProjectUserMapper;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO;
|
||||
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-02-02
|
||||
*/
|
||||
@Service
|
||||
public class ProjectUserImpl extends ServiceImpl<ProjectUserMapper, ProjectUser> implements IProjectUserService{
|
||||
@Autowired
|
||||
private ProjectUserMapper projectUserMapper;
|
||||
|
||||
/**
|
||||
* 查询项目-用户关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectUserPO> queryList(ProjectUserDO projectUserDO)
|
||||
{
|
||||
return projectUserMapper.queryList(projectUserDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目-用户关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(ProjectUserDO projectUserDO) {
|
||||
ProjectUser projectUser = new ProjectUser();
|
||||
BeanUtils.copyProperties(projectUserDO,projectUser);
|
||||
return this.save(projectUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目-用户关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(ProjectUserDO projectUserDO) {
|
||||
ProjectUser projectUser = new ProjectUser();
|
||||
BeanUtils.copyProperties(projectUserDO,projectUser);
|
||||
return this.updateById(projectUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目-用户关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Long[] projectUserIds ) {
|
||||
List<ProjectUser> list = new ArrayList<>();
|
||||
for (Long id : projectUserIds) {
|
||||
ProjectUser projectUser = new ProjectUser();
|
||||
projectUser.setProjectUserId(id);
|
||||
projectUser.setDelFlag(2);
|
||||
list.add(projectUser);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目-用户关联
|
||||
*/
|
||||
@Override
|
||||
public ProjectUserPO getInfo(Long projectUserId) {
|
||||
ProjectUser projectUser = this.getById(projectUserId);
|
||||
ProjectUserPO projectUserPO = new ProjectUserPO();
|
||||
BeanUtils.copyProperties(projectUser,projectUserPO);
|
||||
return projectUserPO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByProjectAccount(ProjectUserDO projectUserDO) {
|
||||
QueryWrapper<ProjectUser> wrapper = new QueryWrapper<>();
|
||||
if (projectUserDO.getProjectManagementId() != null){
|
||||
wrapper.eq("project_management_id", projectUserDO.getProjectManagementId());
|
||||
}
|
||||
if (projectUserDO.getUserId() != null){
|
||||
wrapper.eq("user_id", projectUserDO.getUserId());
|
||||
}
|
||||
if (projectUserDO.getProjectManagementIdList() != null && !projectUserDO.getProjectManagementIdList().isEmpty()){
|
||||
wrapper.in("project_management_id", projectUserDO.getProjectManagementIdList());
|
||||
}
|
||||
projectUserMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.mhd.user.domain.projectUser.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;
|
||||
|
||||
|
||||
/**
|
||||
* 项目-用户关联对象 project_user
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ProjectUserDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("项目用户关联表ID")
|
||||
private Long projectUserId;
|
||||
|
||||
@ApiModelProperty("项目表ID")
|
||||
@Excel(name = "项目表ID")
|
||||
private Long projectManagementId;
|
||||
|
||||
@ApiModelProperty("用户表ID")
|
||||
@Excel(name = "用户表ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "项目ID集合")
|
||||
private List<Long> projectManagementIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
@ApiModelProperty("用户表名称")
|
||||
@Excel(name = "用户表名称")
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "用户表信息")
|
||||
private String userInfo;
|
||||
|
||||
@ApiModelProperty("是否绑定 1-是,2-否")
|
||||
private Integer isBand;
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.mhd.user.domain.projectUser.service;
|
||||
|
||||
import com.mhd.user.domain.projectUser.entity.ProjectUser;
|
||||
import com.mhd.user.domain.projectUser.repository.facade.IProjectUserService;
|
||||
import com.mhd.common.core.domain.po.projectManagement.ProjectUserPO;
|
||||
import com.mhd.user.domain.projectUser.repository.todo.ProjectUserDO;
|
||||
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-02-02
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProjectUserDomainService {
|
||||
|
||||
@Autowired
|
||||
private IProjectUserService projectUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询项目-用户关联列表
|
||||
*/
|
||||
public List<ProjectUserPO> queryList(ProjectUserDO projectUserDO) {
|
||||
return projectUserService.queryList(projectUserDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增项目-用户关联
|
||||
*/
|
||||
public Boolean insert(ProjectUserDO projectUserDO) {
|
||||
|
||||
return projectUserService.insert(projectUserDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目-用户关联
|
||||
*/
|
||||
public Boolean update(ProjectUserDO projectUserDO) {
|
||||
return projectUserService.update(projectUserDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目-用户关联
|
||||
*/
|
||||
public Boolean delete(Long[] projectUserIds) {
|
||||
return projectUserService.delete(projectUserIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目-用户关联详细信息
|
||||
*/
|
||||
public ProjectUserPO getInfo(Long projectUserId)
|
||||
{
|
||||
return projectUserService.getInfo(projectUserId);
|
||||
}
|
||||
|
||||
|
||||
public void deleteByProjectAccount(ProjectUserDO projectUserDO) {
|
||||
projectUserService.deleteByProjectAccount(projectUserDO);
|
||||
}
|
||||
|
||||
public void saveBatchList(List<ProjectUser> projectUserList) {
|
||||
projectUserService.saveBatch(projectUserList);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.user.domain.roleAggregate.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;
|
||||
|
||||
@TableName("custom_auth_role")
|
||||
@Data
|
||||
public class CustomAuthRoleEntity extends BaseVOEntity implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "用户自定义权限表id")
|
||||
private Long customAuthRoleId;
|
||||
@ApiModelProperty(name = "角色id")
|
||||
private Long roleId;
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "表格json")
|
||||
private String tableJson;
|
||||
@ApiModelProperty(name = "表单json")
|
||||
private String formJson;
|
||||
@ApiModelProperty(name = "按钮json")
|
||||
private String buttonJson;
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.user.domain.roleAggregate.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;
|
||||
|
||||
@TableName("custom_auth_user")
|
||||
@Data
|
||||
public class CustomAuthUserEntity extends BaseVOEntity implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "角色自定义权限表id")
|
||||
private Long customAuthUserId;
|
||||
@ApiModelProperty(name = "用户id")
|
||||
private Long userId;
|
||||
@ApiModelProperty(name = "菜单id")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "表格json")
|
||||
private String tableJson;
|
||||
@ApiModelProperty(name = "表单json")
|
||||
private String formJson;
|
||||
@ApiModelProperty(name = "按钮json")
|
||||
private String buttonJson;
|
||||
}
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.mhd.user.domain.roleAggregate.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;
|
||||
|
||||
@Data
|
||||
@TableName("role")
|
||||
public class RoleEntity extends BaseVOEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty(name = "角色表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long roleId;
|
||||
@ApiModelProperty(name = "上级角色ID(预留字段)")
|
||||
private Long parentRoleId;
|
||||
@ApiModelProperty(name = "角色业务场景数据字典ID")
|
||||
private Long roleBusinessExampleId;
|
||||
@ApiModelProperty(name = "角色业务场景名称")
|
||||
private String roleBusinessExampleName;
|
||||
@ApiModelProperty(name = "角色分类:0-无状态,1-托运人,2-承运人")
|
||||
private Integer roleType;
|
||||
@ApiModelProperty(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
@ApiModelProperty(name = "职务/角色权限字符,控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)")
|
||||
private String roleCode;
|
||||
@ApiModelProperty(name = "职务/角色名称")
|
||||
private String roleName;
|
||||
@ApiModelProperty(name = "职务/角色描述")
|
||||
private String roleRemark;
|
||||
@ApiModelProperty(name = "数据权限范围:0-无状态,1-全公司,2-本部门,3-本部门及以下,4-自定义权限")
|
||||
private Integer roleDataScope;
|
||||
@ApiModelProperty(name = "职务/角色状态:0-无状态,1-开启,2-关闭")
|
||||
private Integer roleStatus;
|
||||
@ApiModelProperty(name = "角色等级:0-无状态,1-内置角色,2-组织角色,3-货主自建角色")
|
||||
private Integer roleGrade;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.mhd.user.domain.roleAggregate.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;
|
||||
|
||||
|
||||
@Data
|
||||
@TableName("role_menu")
|
||||
public class RoleMenuEntity extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "职务/角色权限表ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long roleMenuId;
|
||||
@ApiModelProperty(name = "职务/角色表ID")
|
||||
private Long roleId;
|
||||
@ApiModelProperty(name = "权限表ID")
|
||||
private Long menuId;
|
||||
@ApiModelProperty(name = "组织id")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty(name = "角色权限客户端:0-无状态,1-PC端,2-手机端")
|
||||
private Integer roleMenuClient;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.mhd.user.domain.roleAggregate.factory;
|
||||
|
||||
import com.mhd.user.domain.roleAggregate.entity.CustomAuthRoleEntity;
|
||||
import com.mhd.user.domain.roleAggregate.entity.CustomAuthUserEntity;
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleFactory {
|
||||
|
||||
public RoleEntity getRoleEntity(RoleDo roleDo) {
|
||||
RoleEntity roleEntity = new RoleEntity();
|
||||
BeanUtils.copyProperties(roleDo, roleEntity, IgnoreNullUtil.getNullPropertyNames(roleDo));
|
||||
return roleEntity;
|
||||
}
|
||||
public CustomAuthRoleEntity getCustomAuthRoleEntity(CustomAuthDO customAuthDO) {
|
||||
CustomAuthRoleEntity customAuthRoleEntity = new CustomAuthRoleEntity();
|
||||
BeanUtils.copyProperties(customAuthDO, customAuthRoleEntity, IgnoreNullUtil.getNullPropertyNames(customAuthDO));
|
||||
return customAuthRoleEntity;
|
||||
}
|
||||
|
||||
|
||||
public CustomAuthUserEntity getCustomAuthUserEntity(CustomAuthDO customAuthDO) {
|
||||
CustomAuthUserEntity customAuthUserEntity = new CustomAuthUserEntity();
|
||||
BeanUtils.copyProperties(customAuthDO, customAuthUserEntity, IgnoreNullUtil.getNullPropertyNames(customAuthDO));
|
||||
return customAuthUserEntity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mhd.user.domain.roleAggregate.factory;
|
||||
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleMenuEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class RoleMenuFactory {
|
||||
|
||||
public RoleMenuEntity getRoleMenuEntity(RoleMenuDo roleMenuDo) {
|
||||
RoleMenuEntity roleMenuEntity = new RoleMenuEntity();
|
||||
BeanUtils.copyProperties(roleMenuDo, roleMenuEntity, IgnoreNullUtil.getNullPropertyNames(roleMenuDo));
|
||||
return roleMenuEntity;
|
||||
}
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mhd.user.domain.roleAggregate.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.roleAggregate.entity.CustomAuthRoleEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomAuthRoleRepositoryInterface extends IService<CustomAuthRoleEntity> {
|
||||
|
||||
List<CustomAuthRoleOrUserPO> getCustomAuthByRoleOrUserId(CustomAuthDO customAuthDO);
|
||||
|
||||
CustomAuthRoleOrUserPO getCustomAuthMenuByRoleOrUserId(CustomAuthDO customAuthDO);
|
||||
|
||||
int insertCustomAuthRole(CustomAuthRoleEntity customAuthRoleEntity);
|
||||
|
||||
void deleteCustomAuthRoleByRoleId(CustomAuthDO customAuthDO);
|
||||
|
||||
List<CustomAuthRoleEntity> selectByRoleIdList(List<Long> codeList);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mhd.user.domain.roleAggregate.repository.facade;
|
||||
|
||||
import com.mhd.user.domain.roleAggregate.entity.CustomAuthUserEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.po.CustomAuthRoleOrUserPO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.CustomAuthDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomAuthUserRepositoryInterface {
|
||||
|
||||
List<CustomAuthRoleOrUserPO> getCustomAuthByRoleOrUserId(CustomAuthDO customAuthDO);
|
||||
List<CustomAuthRoleOrUserPO> getCustomAuthByRole(CustomAuthDO customAuthDO);
|
||||
|
||||
int insertCustomAuthUser(CustomAuthUserEntity customAuthUserEntity);
|
||||
|
||||
void deleteCustomAuthUserByUserId(CustomAuthDO customAuthDO);
|
||||
|
||||
CustomAuthRoleOrUserPO getCustomAuthMenuByRoleOrUserId(CustomAuthDO customAuthDO);
|
||||
|
||||
CustomAuthRoleOrUserPO getCustomAuthByRoleId(CustomAuthDO customAuthDO);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.mhd.user.domain.roleAggregate.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleMenuEntity;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleMenuDo;
|
||||
import com.mhd.common.core.domain.po.UserRoleMenuPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RoleMenuRepositoryInterface extends IService<RoleMenuEntity> {
|
||||
|
||||
int addRoleMenu(RoleMenuEntity roleMenuEntity);
|
||||
|
||||
int updateRoleMenu(RoleMenuEntity roleMenuEntity);
|
||||
|
||||
void removeByRoleId(RoleMenuDo roleMenuDo);
|
||||
|
||||
List<RoleMenuEntity> selectList(RoleMenuDo roleMenuDo);
|
||||
|
||||
List<UserRoleMenuPO> selectRoleMenuList(RoleMenuDo roleMenuDo);
|
||||
|
||||
RoleMenuEntity findByRoleMenuId(RoleMenuDo roleMenuDo);
|
||||
|
||||
List<RoleMenuEntity> selectByRoleList(List<Long> roleList);
|
||||
}
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.mhd.user.domain.roleAggregate.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.user.domain.roleAggregate.entity.RoleEntity;
|
||||
import com.mhd.common.core.domain.po.RolePO;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RoleRepositoryInterface extends IService<RoleEntity> {
|
||||
|
||||
int addRole(RoleEntity roleEntity);
|
||||
|
||||
void saveBatchList(List<RoleEntity> list);
|
||||
|
||||
int updateRole(RoleEntity roleEntity);
|
||||
|
||||
RoleEntity selectByOrganizationIdAndRoleCode(RoleDo roleDo);
|
||||
|
||||
List<RolePO> selecRolePoList(RoleDo roleDo);
|
||||
|
||||
RolePO findDelByRoleId(Long roleId);
|
||||
|
||||
RolePO findByRoleId(Long roleId);
|
||||
|
||||
RolePO selectByRoleCodeAndOrganizationId(String roleCode, Long organizationId);
|
||||
|
||||
|
||||
RolePO selectRoleByOrganizationAndCode(RoleDo roleDo);
|
||||
|
||||
void deleteByOrganizationId(Long organizationId);
|
||||
|
||||
String findRoleNameByRoleIds(List<Long> roleIds);
|
||||
|
||||
List<RoleEntity> selectByRoleIds(List<Long> roleIds);
|
||||
|
||||
List<RoleEntity> queryList(RoleDo roleDo);
|
||||
|
||||
List<RoleEntity> selectByCodesAndOrganizationIds(List<String> delCodes, List<Long> longs);
|
||||
|
||||
List<RoleEntity> selectByOrganizations(String roleCode , List<Long> organizationIds);
|
||||
|
||||
List<RolePO> getRoleListByUserId(Long userId);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user