| | |
| | | param.put("page", "pages/home/home"); |
| | | param.put("width", 430); //二维码尺寸 |
| | | param.put("scene", "driverId=" + uid); |
| | | param.put("env_version", "trial"); //正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。 |
| | | param.put("env_version", "release"); //正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。 |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.body(JSON.toJSONString(param)); |
| | | |
| | |
| | | if (fileName == null || "".equals(fileName)) { |
| | | String appletPath = "pages/home/scanPage/scanPage"; |
| | | //HttpURLConnection httpURLConnection = weChatUtil.getwxacodeunlimit(appletPath, "d=" + driverId + "&k=" + 0, "release",driverId); |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId, "trial"); |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId, "release"); |
| | | if (inputStream != null) { |
| | | File file = FileUtil.writeFromStream(inputStream, new File(filePath + "/" + UUID.randomUUID().toString() + ".png")); |
| | | HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); |
| | |
| | | } |
| | | } |
| | | //专车业务需要校验 |
| | | if(0 == driver.getIsSynchronous() && type.contains("1")){ |
| | | if(0 == driver.getIsSynchronous() && (type.contains("1") || type.contains("3"))){ |
| | | return ResultUtil.error("请先开通钱包"); |
| | | } |
| | | //判断车辆是否正在使用中 |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RefundInfoRequest { |
| | | /** |
| | | * 支付交易明细标识 |
| | | */ |
| | | private String payItemId; |
| | | /** |
| | | * 支付工单标识 |
| | | */ |
| | | private String payId; |
| | | /** |
| | | * 交易金额,单位分 |
| | | */ |
| | | private String tradeFee; |
| | | } |
| | |
| | | server: |
| | | port: 8007 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | server: |
| | | port: 8007 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; |
| | | |
| | | /** |
| | | * spring session配置 |
| | |
| | | * @date 2017-07-13 21:05 |
| | | */ |
| | | @Configuration |
| | | @EnableRedisHttpSession(maxInactiveIntervalInSeconds = 28800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | //@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 28800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | //@ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public class SpringSessionConfig { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.modular.shunfeng.model.AppDriverRide; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IAppDriverRideService; |
| | | import com.stylefeng.guns.modular.system.model.TCarBrand; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.ITCarBrandService; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 顺风车司机控制器 |
| | |
| | | |
| | | @Autowired |
| | | private IAppDriverRideService appDriverRideService; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private IUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | @Autowired |
| | | private ITCarBrandService carBrandService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | /** |
| | | * 跳转到顺风车司机首页 |
| | |
| | | if(appDriverRide.getState()!=null && appDriverRide.getState()==2){//顺风车司机通过审核之后需要把id绑定到用户表中 |
| | | userInfo.setIsDriverRide(1);//是否为顺风车司机(0否,1是) |
| | | userService.updateById(userInfo); |
| | | |
| | | TCompany tCompany = itCompanyService.selectById(appDriverRide1.getCompanyId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(userInfo.getPhone(), tCompany.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | User user2 = sysUserService.selectById(user.getId()); |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(user2.getPhone()); |
| | | request.setEntercode(tCompany.getEnterCode()); |
| | | request.setEmpName(userInfo.getName()); |
| | | request.setEmpNickname(userInfo.getName()); |
| | | request.setLoginNo(userInfo.getPhone()); |
| | | request.setEmpSex(userInfo.getSex() == 1 ? "男" : "女"); |
| | | request.setMphone(userInfo.getPhone()); |
| | | request.setEmail(userInfo.getPhone() + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | |
| | | appDriverRide.setEmpId(empId); |
| | | appDriverRide.setEntercode(tCompany.getEnterCode()); |
| | | appDriverRide.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | appDriverRide.setEmpnew(empnew); |
| | | //编写异步延迟处理中台账号延迟创建的问题 |
| | | if(0 == empId){ |
| | | Timer timer = new Timer(); |
| | | String finalEnterCode = tCompany.getEnterCode(); |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(userInfo.getPhone(), finalEnterCode); |
| | | if(null != userInfoByPhone && userInfoByPhone.size() > 0){ |
| | | Long empId1 = userInfoByPhone.get(0).getEmpId(); |
| | | appDriverRide.setEmpId(empId1); |
| | | appDriverRideService.updateById(appDriverRide); |
| | | } |
| | | } |
| | | },120*1000); |
| | | } |
| | | }else { |
| | | if(certificationImg!=null){ |
| | | userInfo.setCertificationImg(certificationImg); |
| | |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer excep; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | /** |
| | | * 中台新增状态(0=否,1=是) |
| | | */ |
| | | @TableField("empnew") |
| | | private Integer empnew; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.excep = excep; |
| | | } |
| | | |
| | | public Long getEmpId() { |
| | | return empId; |
| | | } |
| | | |
| | | public void setEmpId(Long empId) { |
| | | this.empId = empId; |
| | | } |
| | | |
| | | public Long getEnterId() { |
| | | return enterId; |
| | | } |
| | | |
| | | public void setEnterId(Long enterId) { |
| | | this.enterId = enterId; |
| | | } |
| | | |
| | | public String getEntercode() { |
| | | return entercode; |
| | | } |
| | | |
| | | public void setEntercode(String entercode) { |
| | | this.entercode = entercode; |
| | | } |
| | | |
| | | public Integer getEmpnew() { |
| | | return empnew; |
| | | } |
| | | |
| | | public void setEmpnew(Integer empnew) { |
| | | this.empnew = empnew; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt())); |
| | | user.setStatus(ManagerStatus.OK.getCode()); |
| | | user.setCreatetime(new Date()); |
| | | user.setEmpId(empId); |
| | | user.setEntercode(tCompany.getEnterCode()); |
| | | user.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | |
| | | User objectUser = UserFactory.createUser(user); |
| | | objectUser.setObjectId(user1.getObjectId()); |
| | | objectUser.setEmpId(empId); |
| | | objectUser.setEmpnew(empnew); |
| | | objectUser.setEntercode(tCompany.getEnterCode()); |
| | | objectUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | this.userService.insert(objectUser); |
| | | |
| | | return SUCCESS_TIP; |
| | |
| | | public QianYunTongConfig getQianYunTongConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.appkey = "10001104"; |
| | | this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; |
| | | this.privateKeyPath = "E:\\项目文档\\黔云通\\private_key_test.pem"; |
| | | this.userName = "xiaofei"; |
| | | this.status = "1"; |
| | | this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); |
| | |
| | | server: |
| | | port: 8010 |
| | | servlet: |
| | | session: |
| | | cookie: |
| | | name: CHUXINGSID |
| | | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| | | session: |
| | | redis: |
| | | namespace: spring:chuxing:session |
| | | store-type: redis |
| | | timeout: 1800 |
| | | |
| | | mybatis-plus: |
| | | type-aliases-package: com.stylefeng.guns.modular |
| | |
| | | server: |
| | | port: 8010 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | servlet: |
| | | session: |
| | | cookie: |
| | | name: CHUXINGSID |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | multipart: |
| | | max-request-size: 500MB |
| | | max-file-size: 500MB |
| | | session: |
| | | redis: |
| | | namespace: spring:chuxing:session |
| | | store-type: redis |
| | | timeout: 1800 |
| | | redis: |
| | | host: 10.31.1.219 |
| | | port: 6410 |
| | |
| | | server: |
| | | port: 8080 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | servlet: |
| | | session: |
| | | cookie: |
| | | name: CHUXINGSID |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | multipart: |
| | | max-request-size: 500MB |
| | | max-file-size: 500MB |
| | | session: |
| | | redis: |
| | | namespace: spring:chuxing:session |
| | | store-type: redis |
| | | timeout: 1800 |
| | | redis: |
| | | host: 10.88.154.24 |
| | | port: 7560 |
| | |
| | | <div class="form-group" id="areaType2Div" style="display: none;"> |
| | | <label class="col-sm-2 control-label">电子围栏:</label> |
| | | <div class="col-sm-8"> |
| | | <div id="container" style="height: 350px;width: 1000px;"></div> |
| | | <div id="container" style="height: 550px;width: 1000px;"></div> |
| | | <div class='info' style="margin-top:10px;position: absolute; z-index: 999; left: 20px; width: 450px;">操作说明:圆和矩形通过拖拽来绘制,其他覆盖物通过点击来绘制</div> |
| | | <div class="input-card" style='margin-top:28px;width: 100rem; z-index: 999; bottom: 20px;'> |
| | | <div class="input-item"> |
| | |
| | | <div class="form-group" id="areaType2Div" style="display: ${type2};"> |
| | | <label class="col-sm-2 control-label">电子围栏:</label> |
| | | <div class="col-sm-8"> |
| | | <div id="container" style="height: 350px;width: 1000px;"></div> |
| | | <div id="container" style="height: 550px;width: 1000px;"></div> |
| | | <div class='info' style="margin-top:10px;position: absolute; z-index: 999; left: 20px; width: 450px;">操作说明:圆和矩形通过拖拽来绘制,其他覆盖物通过点击来绘制</div> |
| | | <div class="input-card" style='margin-top:28px;width: 100rem; z-index: 999; bottom: 20px;'> |
| | | <div class="input-item"> |
| | |
| | | {title: '操作', field: 'opt', visible: true, align: 'left', valign: 'middle',width:"7%", |
| | | formatter: function (value, row) { |
| | | var btn=[]; |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAppDriverRideDetail('+row.id+')">查看图片</a>'; |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAddAppDriverRide('+row.id+')">编辑</a>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAppDriverRideDetail('+row.id+')">查看图片</a>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAddAppDriverRide('+row.id+')">编辑</a>'; |
| | | if(row.status==1){ |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.isState('+row.id+',2)">锁定</a></p>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.isState('+row.id+',2)">锁定</a></p>'; |
| | | }else{ |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.isState('+row.id+',1)">解锁</a></p>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.isState('+row.id+',1)">解锁</a></p>'; |
| | | } |
| | | return btn; |
| | | |
| | |
| | | {title: '操作', field: 'opt', visible: true, align: 'left', valign: 'middle',width:"5%", |
| | | formatter: function (value, row) { |
| | | var btn=[]; |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAppDriverRideDetail('+row.id+')">查看图片</a>'; |
| | | btn+='<p style="line-height: 10px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAddAppDriverRide('+row.id+')">查看详情</a>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAppDriverRideDetail('+row.id+')">查看图片</a>'; |
| | | btn+='<p style="line-height: 20px;"><a href="javascript:void(0);" onclick="AppDriverRide.openAddAppDriverRide('+row.id+')">查看详情</a>'; |
| | | return btn; |
| | | |
| | | } |
| | |
| | | var num2 = $("#num2").val(); |
| | | var num3 = $("#num3").val(); |
| | | var num4 = $("#num4").val(); |
| | | if(!regDouble.test(num1) || !regDouble.test(num2) || !regXiShu.test(num3) || !regXiShu.test(num4)){ |
| | | if(null == num1 || '' == num1 || null == num2 || '' == num2 || null == num3 || '' == num3 || null == num4 || '' == num4){ |
| | | Feng.info("固定计价格式不正确!"); |
| | | return; |
| | | } |
| | | // if(!regDouble.test(num1) || !regDouble.test(num2) || !regXiShu.test(num3) || !regXiShu.test(num4)){ |
| | | // Feng.info("固定计价格式不正确!"); |
| | | // return; |
| | | // } |
| | | content = '{"num1":"'+num1+'","num2":"'+num2+'","num3":"'+num3+'","num4":"'+num4+'"}'; |
| | | contentStr = "单人价格:"+num1+";包车价格:"+num2+";五座系数:"+num3+";七座系数:"+num4+";"; |
| | | } else if (2 == type){ |
| | |
| | | var num16 = $("#num16").val(); |
| | | var num17 = $("#num17").val(); |
| | | var num18 = $("#num18").val(); |
| | | if(!regDouble.test(num11) || !regDouble.test(num12) || !regDouble.test(num13) || !regXiShu1.test(num14) || !regXiShu.test(num15) || !regXiShu.test(num16) || !regXiShu.test(num17) || !regXiShu.test(num18)){ |
| | | if(null == num11 || '' == num11 || null == num12 || '' == num12 || null == num13 || '' == num13 || null == num14 || '' == num14 |
| | | || null == num15 || '' == num15 || null == num16 || '' == num16 || null == num17 || '' == num17 || null == num18 || '' == num18){ |
| | | Feng.info("浮动计价格式不正确!"); |
| | | return; |
| | | } |
| | | // if(!regDouble.test(num11) || !regDouble.test(num12) || !regDouble.test(num13) || !regXiShu1.test(num14) || !regXiShu.test(num15) || !regXiShu.test(num16) || !regXiShu.test(num17) || !regXiShu.test(num18)){ |
| | | // Feng.info("浮动计价格式不正确!"); |
| | | // return; |
| | | // } |
| | | content = '{"num1":"'+num11+'","num2":"'+num12+'","num3":"'+num13+'","num4":"'+num14+'","num5":"'+num15+'","num6":"'+num16+'","num7":"'+num17+'","num8":"'+num18+'"}'; |
| | | contentStr = "参考价格:"+num11+";参考里程:"+num12+";保底价:"+num13+";超出参考里程优惠系数:"+num14+";低于参考里程优惠系数:"+num15+";包车系数:"+num16+";五座系数:"+num17+";七座系数:"+num18+";"; |
| | | } |
| | |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/javabase64-1.3.1.jar</systemPath> |
| | | </dependency> |
| | | <!--证联sdk--> |
| | | <dependency> |
| | | <groupId>zl</groupId> |
| | | <artifactId>security</artifactId> |
| | | <version>1.2.2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/zl-util-security-1.2.2.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | |
| | | import com.stylefeng.guns.modular.call.server.IOrderCallService; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.shunfeng.model.DriverRide; |
| | | import com.stylefeng.guns.modular.shunfeng.model.OrderRide; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IDriverRideService; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IOrderRideService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | |
| | | import com.stylefeng.guns.modular.system.pdf.TripSheetGenerator; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.AddAccountInfoRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTPaymentCallback; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTPaymentCallbackData; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.ZhengLianUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TradeTerminalInfo; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.ZLUserInfo; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | |
| | | import java.io.PrintWriter; |
| | | import java.io.Serializable; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderRideService orderRideService; |
| | | /*顺风车司机*/ |
| | | @Autowired |
| | | private IDriverRideService driverRideService; |
| | | |
| | | |
| | | /** |
| | |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(null != userInfo.getDriverId()){ |
| | | DriverRide driverRide = driverRideService.selectById(userInfo.getDriverId()); |
| | | //获取证联数据 |
| | | if(null == driverRide.getCustId() || 0 == driverRide.getAccOpenFlag()){ |
| | | TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo(); |
| | | tradeTerminalInfo.setTerminal("1"); |
| | | InetAddress inetAddress = InetAddress.getLocalHost(); |
| | | String ip = inetAddress.getHostAddress(); |
| | | tradeTerminalInfo.setIp(ip); |
| | | NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress); |
| | | byte[] mac = networkInterface.getHardwareAddress(); |
| | | StringBuilder macAddress = new StringBuilder(); |
| | | for (int i = 0; i < mac.length; i++) { |
| | | macAddress.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); |
| | | } |
| | | |
| | | tradeTerminalInfo.setMac(macAddress.toString()); |
| | | ZLUserInfo userInfo1 = ZhengLianUtil.getUserInfo(driverRide.getEmpId().toString(), tradeTerminalInfo); |
| | | if(null != userInfo){ |
| | | driverRide.setCustId(userInfo1.getCustId()); |
| | | driverRide.setAccOpenFlag(userInfo1.getAccOpenFlag()); |
| | | driverRideService.updateById(driverRide); |
| | | } |
| | | } |
| | | //同步到中台 |
| | | if(null != driverRide.getAccOpenFlag() && 1 == driverRide.getAccOpenFlag() && 0 == driverRide.getIsSynchronous()){ |
| | | AddAccountInfoRequest request1 = new AddAccountInfoRequest(); |
| | | request1.setCustId(driverRide.getCustId()); |
| | | request1.setAccountNo(driverRide.getEmpId().toString()); |
| | | request1.setAccountName(userInfo.getName()); |
| | | request1.setMobile(userInfo.getPhone()); |
| | | Integer status = EmployeeUtil.addAccountInfo(request1); |
| | | if(0 == status){ |
| | | driverRide.setIsSynchronous(1); |
| | | driverRideService.updateById(driverRide); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | List<OrderStatusWarpper> data = new ArrayList<>(); |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for (OrderPrivateCar orderPrivateCar : orderPrivateCars) { |
| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.shunfeng.model.DriverRide; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IDriverRideService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.TokenUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.ZhengLianUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TradeTerminalInfo; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.ZLUserInfo; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.VerifiedWarpper; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.InputStream; |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | /*顺风车司机*/ |
| | | @Autowired |
| | | private IDriverRideService driverRideService; |
| | | |
| | | @Autowired |
| | | private IVerifiedService verifiedService; |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/oneClickLogin") |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/wxLogin") |
| | | @ApiOperation(value = "微信授权登录", tags = {"用户端-登录"}, notes = "") |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/wxLoginIsBind") |
| | | @ApiOperation(value = "微信授权登录--查看是否绑定手机号", tags = {"用户端-登录"}, notes = "") |
| | |
| | | userInfo.setOnconUUID(onconUUIDByMobile); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | |
| | | Map<String, Object> map = userInfoService.queryUserInfo(uid); |
| | | UserWithdrawal userWithdrawal1 = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", map.get("phone")) |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/base/user/getDriverCode") |
| | | @ApiOperation(value = "获取司机端的二维码", tags = {"获取司机端的二维码"}, notes = "") |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/addAppUser") |
| | | public String addAppUser(String phone, String code, String areaCode){ |
| | | public String addAppUser(String phone, String code, String areaCode, String onconUUID){ |
| | | try { |
| | | return userInfoService.addAppUser(phone, code, areaCode); |
| | | return userInfoService.addAppUser(phone, code, areaCode, onconUUID); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getZLToken") |
| | | @ApiOperation(value = "获取证联token(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "当前设备IP地址", name = "ip", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前设备mac地址", name = "mac", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "01 证联收银台支付\n" + |
| | | "\t 04 HOME 页\n" + |
| | | "\t 06 申请免密签约\n" + |
| | | "\t 07 商户收银台支付\n" + |
| | | "\t 08 开户(绑卡)\n" + |
| | | "\t 09 开通支付账户\n" + |
| | | "\t 10 打开付款码", name = "type", required = true, dataType = "String"), |
| | | }) |
| | | public ResultUtil<String> getZLToken(String ip, String mac, String type, HttpServletRequest request){ |
| | | try { |
| | | Integer userId = userInfoService.getUserIdFormRedis(request); |
| | | if (null == userId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(userId); |
| | | if(null == userInfo.getDriverId()){ |
| | | return ResultUtil.error("请先开通顺风车司机"); |
| | | } |
| | | if(null == userInfo.getIdCard()){ |
| | | return ResultUtil.error("请先完成实名认证"); |
| | | } |
| | | DriverRide driverRide = driverRideService.selectById(userInfo.getDriverId()); |
| | | TokenRequest tokenRequest = new TokenRequest(); |
| | | tokenRequest.setAppUserId(driverRide.getEmpId().toString()); |
| | | tokenRequest.setUserName(userInfo.getName()); |
| | | tokenRequest.setCertNo(userInfo.getIdCard()); |
| | | tokenRequest.setPhone(userInfo.getPhone()); |
| | | TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo(); |
| | | tradeTerminalInfo.setIp(ip); |
| | | tradeTerminalInfo.setTerminal("1"); |
| | | tradeTerminalInfo.setMac(mac); |
| | | tokenRequest.setTradeTerminalInfo(tradeTerminalInfo); |
| | | tokenRequest.setType(type); |
| | | String token = TokenUtil.getToken(tokenRequest); |
| | | return ResultUtil.success(token); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.shunfeng.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.shunfeng.model.Financial; |
| | | import com.stylefeng.guns.modular.shunfeng.model.OrderRide; |
| | | import com.stylefeng.guns.modular.shunfeng.model.vo.ApiJson; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IDriverRideService; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IFinancialService; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IOrderRideService; |
| | | import com.stylefeng.guns.modular.shunfeng.service.ITimeTaskService; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 支付相关接口 |
| | |
| | | private IUserInfoService userInfoService; |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | /*顺风车司机*/ |
| | | @Autowired |
| | | private IDriverRideService driverRideService; |
| | | @Autowired |
| | | private IFinancialService financialService; |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"), |
| | | @ApiImplicitParam(name = "payType", value = "支付类型 1=支付宝,2 = 微信 3:银行卡 4:小程序", dataType = "int"), |
| | | @ApiImplicitParam(name = "path", value = "前端支付很后的跳转页面", dataType = "string"), |
| | | @ApiImplicitParam(name = "ip", value = "前端支付IP地址", dataType = "string"), |
| | | }) |
| | | public Object payOnline(Integer orderId,Integer type,String code,Integer payType,Integer isBalance,HttpServletRequest request,Integer couponId){ |
| | | public Object payOnline(Integer orderId,Integer type,String code,Integer payType,Integer isBalance, |
| | | String path, String ip, HttpServletRequest request,Integer couponId){ |
| | | try { |
| | | if(orderId == null || orderId == 0){ |
| | | return ApiJson.returnNG("订单ID不能为空"); |
| | |
| | | if(orderRide.getState()==2){//已支付 |
| | | return ApiJson.returnNG("该订单不需要支付"); |
| | | } |
| | | info = new PayUtil().getPayInfo(payType,orderRide.getOrderNum(),openId,request); |
| | | Double orderMoney = orderRide.getMoney(); |
| | | if(2 == payType){ |
| | | UserInfo userInfo = userInfoService.selectById(orderRide.getUserId()); |
| | | if(null == orderRide.getIsCreated() || 0 == orderRide.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | | tradeOrderCreateData.setTreatShopId("0"); |
| | | tradeOrderCreateData.setField1("{\"profitSharing\":\"1\",\"isCompensate\":\"0\",\"isPromote\":\"0\"}"); |
| | | tradeOrderCreateData.setCharge(new BigDecimal(orderMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | tradeOrderCreateData.setOrderNo("SF" + orderRide.getId()); |
| | | tradeOrderCreateData.setCustomerId(userInfo.getOnconUUID()); |
| | | tradeOrderCreateData.setPartnerPayId(orderRide.getZttravelId()); |
| | | tradeOrderCreateData.setTotalFee(Double.valueOf(orderMoney * 100).intValue() + ""); |
| | | tradeOrderCreateData.setOrderDesc("完成订单"); |
| | | tradeOrderCreateData.setRetUrl(path); |
| | | tradeOrderCreateData.setClientIp(ip); |
| | | tradeOrderCreateData.setServiceType(4); |
| | | |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradeOrderCreateData.setGoodsInfo(goodsInfo); |
| | | TradeOrderCreate tradeOrderCreate = OrderUtil.tradeOrderCreate1(tradeOrderCreateData, 0); |
| | | PayInfo payInfo = tradeOrderCreate.getPayInfo(); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | orderRide.setIsCreated(1); |
| | | orderRide.setZttravelId(tradeOrderCreate.getOrderInfo().getOrderId()); |
| | | info = payInfo.getData().getRedirectUrl(); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | | tradePayOff1Data.setPartnerPayId(orderRide.getZttravelId()); |
| | | tradePayOff1Data.setTotalFee(Double.valueOf(orderMoney * 100).intValue() + ""); |
| | | tradePayOff1Data.setRetUrl(path); |
| | | tradePayOff1Data.setClientIp(ip); |
| | | tradePayOff1Data.setOrderDesc("完成订单"); |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradePayOff1Data.setGoodsInfo(goodsInfo); |
| | | PayInfo payInfo = OrderUtil.tradePayOff1(tradePayOff1Data, 0); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | info = payInfo.getData().getRedirectUrl(); |
| | | } |
| | | orderRideService.updateById(orderRide); |
| | | |
| | | //创建定时任务查询订单支付状态 |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor.execute(()->{ |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | OrderRide orderRide1 = orderRideService.selectById(orderRide.getId()); |
| | | if (orderRide1.getState() != 1) { |
| | | break; |
| | | } |
| | | GetTravelItineraryListRequest request1 = new GetTravelItineraryListRequest(); |
| | | request1.setCustomerId(userInfo.getOnconUUID()); |
| | | request1.setOrderNo("SF" + orderRide1.getId()); |
| | | ListPage<List<TravelItinerary>> travelItineraryList = OrderUtil.getTravelItineraryList(request1); |
| | | TravelItinerary travelItinerary = travelItineraryList.getList().get(0); |
| | | if(travelItinerary.getStatus() != 7 || Arrays.asList(3, 11).contains(travelItinerary.getOrderStatus())){ |
| | | GetPaymentInfoDataRequest getPaymentInfoDataRequest1 = new GetPaymentInfoDataRequest(); |
| | | getPaymentInfoDataRequest1.setPartnerPayId(orderRide1.getZttravelId()); |
| | | GetPaymentInfo getPaymentInfo1 = OrderUtil.paymentInfo(getPaymentInfoDataRequest1); |
| | | |
| | | String trade_no = getPaymentInfo1.getPayId(); |
| | | Financial financial = new Financial(); |
| | | financial.setType(1);//类型 1=收入 2=支出 |
| | | financial.setPayType("2");//支付类型 1=余额 2=微信 3=支付宝 |
| | | financial.setMoney(orderMoney);//支付金额 |
| | | financial.setOrderNum(orderRide1.getOrderNum());//我们本地的订单号 |
| | | financial.setLsType(trade_no);//流水号 |
| | | financial.setAddTime(new Date()); |
| | | financial.setTradeStatus("success"); |
| | | //顺风车支付 |
| | | //修改订单表中的订单流水和支付方式 |
| | | orderRide1.setOutNum(financial.getLsType());//流水 |
| | | orderRide1.setPayTime(new Date()); |
| | | orderRide1.setPayType(2); |
| | | orderRide1.setState(2); |
| | | financial.setPwType(8);//顺风车 |
| | | financial.setUserId(orderRide1.getUserId()); |
| | | financial.setLx(1);//1=用户 2=司机 |
| | | financial.setOrderType(4);//顺风车 |
| | | financialService.insert(financial); |
| | | orderRideService.updateById(orderRide1); |
| | | /*添加系统消息*/ |
| | | try { |
| | | systemNoticeService.addSystemNotice(1, "您成功支付从" + orderRide1.getStartName() + "到" + orderRide1.getEndName() + "的顺风车订单", orderRide1.getUserId(), 1); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | threadPoolExecutor.shutdown(); |
| | | } |
| | | |
| | | }); |
| | | }else{ |
| | | info = new PayUtil().getPayInfo(payType,orderRide.getOrderNum(),openId,request); |
| | | } |
| | | return ApiJson.returnOK(info); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | //顺风车支付 |
| | | OrderRide orderRide = orderRideService.selectOne(new EntityWrapper<OrderRide>().eq("orderNum", orderNum)); |
| | | price = Double.valueOf(orderRide.getMoney()); |
| | | body = "全客通-顺风车支付"; |
| | | subject = "全客通-顺风车支付"; |
| | | body = "贵人家园-顺风车支付"; |
| | | subject = "贵人家园-顺风车支付"; |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (type == 1) { |
| | |
| | | import com.stylefeng.guns.modular.shunfeng.util.OrdersUtil; |
| | | import com.stylefeng.guns.modular.shunfeng.util.SensitiveWordUtil; |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.model.SensitiveWords; |
| | | import com.stylefeng.guns.modular.system.model.TCarBrand; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.ITCarBrandService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import io.swagger.annotations.*; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private IFinancialService financialService; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | |
| | | |
| | |
| | | driverRide.setBrandId(brandId); |
| | | driverRide.setUserId(userId); |
| | | driverRide.setByInviteCode(inviteCodeRide); |
| | | driverRide.setCompanyId(1); |
| | | driverRide.setCarType(carType); |
| | | driverRide.setCarNum(carNum); |
| | | driverRide.setLicense(license); |
| | |
| | | } |
| | | |
| | | |
| | | private Integer getState(Integer state){ |
| | | switch (state){ |
| | | case 1: |
| | | return 7; |
| | | case 2: |
| | | return 1; |
| | | case 3: |
| | | return 4; |
| | | case 4: |
| | | return 5; |
| | | case 5: |
| | | return 8; |
| | | case 6: |
| | | return 10; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | //用户取消退款 |
| | | public void userCancelTuik(OrderRide orderRide){ |
| | |
| | | }else if(orderRide.getPayType()==2){ |
| | | //微信 |
| | | Integer money = new Double(orderRide.getMoney() * 100).intValue(); |
| | | Integer tMoney_ = new Double(orderRide.getTuiMoney()* 100).intValue(); |
| | | PayUtil.refundForWxpay(1, financial.getLsType(), orderRide.getOrderNum(), finNum, money,tMoney_ , "2"); |
| | | // Integer tMoney_ = new Double(orderRide.getTuiMoney()* 100).intValue(); |
| | | // PayUtil.refundForWxpay(1, financial.getLsType(), orderRide.getOrderNum(), finNum, money,tMoney_ , "2"); |
| | | |
| | | //中台订单退款操作 |
| | | if(ToolUtil.isNotEmpty(orderRide.getZttravelId())){ |
| | | UserInfo userInfo = userInfoService.selectById(orderRide.getUserId()); |
| | | TradeOrderRefundRequest request = new TradeOrderRefundRequest(); |
| | | request.setPartnerPayId(orderRide.getZttravelId()); |
| | | request.setPayId(financial.getLsType()); |
| | | request.setRefundTotalFee(money + ""); |
| | | request.setRemark("顺风车订单取消退款"); |
| | | request.setRefundType("RF"); |
| | | |
| | | RefundInfoRequest refundInfo = new RefundInfoRequest(); |
| | | refundInfo.setPayItemId(orderRide.getZttravelId()); |
| | | refundInfo.setPayId(financial.getLsType()); |
| | | refundInfo.setTradeFee(money + ""); |
| | | request.setRefundInfos(new ArrayList<RefundInfoRequest>(){{ |
| | | add(refundInfo); |
| | | }}); |
| | | TradeOrderRefund tradeOrderRefund = OrderUtil.tradeOrderRefund(request); |
| | | //退款通知 |
| | | OrderRefundNoticeRequest request2 = new OrderRefundNoticeRequest(); |
| | | request2.setOrderId(orderRide.getZttravelId()); |
| | | request2.setRefundPayNum(tradeOrderRefund.getRefundId()); |
| | | request2.setRefundType("5"); |
| | | request2.setApplyRefundCharge(BigDecimal.valueOf(orderRide.getMoney())); |
| | | request2.setActualRefundCharge(BigDecimal.valueOf(orderRide.getMoney())); |
| | | request2.setRefundAccount(userInfo.getOnconUUID()); |
| | | request2.setRemark("顺风车订单取消退款"); |
| | | OrderUtil.orderRefundNotice(request2); |
| | | } |
| | | |
| | | |
| | | }else if(orderRide.getPayType()==3){ |
| | | |
| | | } |
| | |
| | | f.setOrderType(4); |
| | | f.setLx(1); |
| | | financialService.insert(f); |
| | | }else{ |
| | | //未支付的情况取消订单 |
| | | if(ToolUtil.isNotEmpty(orderRide.getZttravelId())){ |
| | | OrderUtil.tradeOrderCancel(orderRide.getZttravelId()); |
| | | } |
| | | } |
| | | /*添加系统消息*/ |
| | | try { |
| | |
| | | if(orderRide!=null && orderRide.getState()==6){ |
| | | return ResultUtil.error("用户已取消该行程"); |
| | | } |
| | | UserInfo userInfo=userInfoService.selectById(driverRide.getUserId()); |
| | | if(orderTravel!=null){ |
| | | if(type==1){//1确认同行 一个行程只能匹配一个订单 |
| | | if(orderTravel.getState()==3){ |
| | |
| | | driverRide.setTotalOrders(driverRide.getTotalOrders()+1); |
| | | driverRideService.updateById(driverRide); |
| | | /*修改用户接单数和司机提成*/ |
| | | UserInfo userInfo=userInfoService.selectById(driverRide.getUserId()); |
| | | |
| | | userInfo.setBalance(userInfo.getBalance()+(orderRide.getMoney()-orderRide.getPlatformMoney())); |
| | | userInfo.setTotalOrders(userInfo.getTotalOrders() + 1); |
| | | userInfoService.updateById(userInfo); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | if(null != orderRide.getZttravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderRide.getZttravelId()); |
| | | request.setStatus(getState(orderRide.getState())); |
| | | if (null != orderRide.getDriverId()) { |
| | | request.setDriverId(driverRide.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | pushUtil.pushOrderState(1, orderRide.getUserId(), orderRide.getId(), 8, orderRide.getState(), null); |
| | | return ResultUtil.success(""); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | * 品牌id |
| | | */ |
| | | private Integer brandId; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | |
| | | @ApiModelProperty("证联客户号") |
| | | private String custId; |
| | | |
| | | @ApiModelProperty("是否已开通支付账户(0:否,1:是)") |
| | | private Integer accOpenFlag; |
| | | |
| | | @ApiModelProperty("是否已同步到中台(0:否,1:是)") |
| | | private Integer isSynchronous; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.brandId = brandId; |
| | | } |
| | | |
| | | public Long getEmpId() { |
| | | return empId; |
| | | } |
| | | |
| | | public void setEmpId(Long empId) { |
| | | this.empId = empId; |
| | | } |
| | | |
| | | public Long getEnterId() { |
| | | return enterId; |
| | | } |
| | | |
| | | public void setEnterId(Long enterId) { |
| | | this.enterId = enterId; |
| | | } |
| | | |
| | | public String getEntercode() { |
| | | return entercode; |
| | | } |
| | | |
| | | public void setEntercode(String entercode) { |
| | | this.entercode = entercode; |
| | | } |
| | | |
| | | public String getCustId() { |
| | | return custId; |
| | | } |
| | | |
| | | public void setCustId(String custId) { |
| | | this.custId = custId; |
| | | } |
| | | |
| | | public Integer getAccOpenFlag() { |
| | | return accOpenFlag; |
| | | } |
| | | |
| | | public void setAccOpenFlag(Integer accOpenFlag) { |
| | | this.accOpenFlag = accOpenFlag; |
| | | } |
| | | |
| | | public Integer getIsSynchronous() { |
| | | return isSynchronous; |
| | | } |
| | | |
| | | public void setIsSynchronous(Integer isSynchronous) { |
| | | this.isSynchronous = isSynchronous; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | * 评价内容 |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 中台行程id |
| | | */ |
| | | private String zttravelId; |
| | | /** |
| | | * 中台是否已创建订单(0=否,1=是) |
| | | */ |
| | | private Integer isCreated; |
| | | |
| | | |
| | | |
| | |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getZttravelId() { |
| | | return zttravelId; |
| | | } |
| | | |
| | | public void setZttravelId(String zttravelId) { |
| | | this.zttravelId = zttravelId; |
| | | } |
| | | |
| | | public Integer getIsCreated() { |
| | | return isCreated; |
| | | } |
| | | |
| | | public void setIsCreated(Integer isCreated) { |
| | | this.isCreated = isCreated; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | package com.stylefeng.guns.modular.shunfeng.task.jobs; |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.shunfeng.model.OrderRide; |
| | | import com.stylefeng.guns.modular.shunfeng.model.TimeTask; |
| | | import com.stylefeng.guns.modular.shunfeng.task.base.AbstractJob; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | |
| | | //自动取消 |
| | | order.setState(6); |
| | | this.orderRideService.updateById(order); |
| | | |
| | | //未支付的情况取消订单 |
| | | if(ToolUtil.isNotEmpty(order.getZttravelId())){ |
| | | OrderUtil.tradeOrderCancel(order.getZttravelId()); |
| | | } |
| | | } |
| | | //修改定时任务数据状态 |
| | | TimeTask timeTask=timeTaskService.selectById(timeTaskId); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private Integer getState(Integer state){ |
| | | switch (state){ |
| | | case 1: |
| | | return 7; |
| | | case 2: |
| | | return 1; |
| | | case 3: |
| | | return 4; |
| | | case 4: |
| | | return 5; |
| | | case 5: |
| | | return 8; |
| | | case 6: |
| | | return 10; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | private CarMapper carMapper; |
| | | |
| | | /** |
| | | * 专车下单操作 |
| | | * |
| | |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | } |
| | | |
| | | String serverCarModel = ""; |
| | | if(2 == orderSource){ |
| | | Driver driver = driverService.selectById(driverId); |
| | | CarService carService = new CarService(); |
| | | carService.setType(1); |
| | | carService.setCarId(driver.getCarId()); |
| | | CarService carService1 = carServiceMapper.selectOne(carService); |
| | | serverCarModel = "{\"serverCarModelId\":" + carService1.getServerCarModelId() + ",\"rideType\":1}"; |
| | | } |
| | | |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | |
| | | orderPrivateCar.setType(type); |
| | | orderPrivateCar.setUserId(uid); |
| | | orderPrivateCar.setServerCarModelId(serverCarModelId); |
| | | orderPrivateCar.setServerCarModel(serverCarModel); |
| | | orderPrivateCar.setOrderNum(this.getOrderNum()); |
| | | orderPrivateCar.setPlacementLon(Double.valueOf(placementLon)); |
| | | orderPrivateCar.setPlacementLat(Double.valueOf(placementLat)); |
| | |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | } |
| | | |
| | | if(2 == orderSource){ |
| | | Driver driver = driverService.selectById(driverId); |
| | | CarService carService = new CarService(); |
| | | carService.setType(1); |
| | | carService.setCarId(driver.getCarId()); |
| | | CarService carService1 = carServiceMapper.selectOne(carService); |
| | | serverCarModel = "{\"serverCarModelId\":" + carService1.getServerCarModelId() + ",\"rideType\":1}"; |
| | | } |
| | | |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | |
| | | if (ToolUtil.isEmpty(serverCarModel)) { |
| | | return ResultUtil.error("请选择服务车型"); |
| | | } |
| | | |
| | | |
| | | OrderPrivateCar orderPrivateCar = new OrderPrivateCar(); |
| | | orderPrivateCar.setPeopleNum(peopleNum); |
| | | orderPrivateCar.setType(3); |
| | |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | String addAppUser(String phone, String code, String areaCode) throws Exception; |
| | | String addAppUser(String phone, String code, String areaCode, String onconUUID) throws Exception; |
| | | } |
| | |
| | | userInfo.setCompanyId(1); |
| | | } |
| | | |
| | | |
| | | |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | /** |
| | | * 手机验证码登录 |
| | | * 手机一键登录 |
| | | * @param accessToken |
| | | * @return |
| | | */ |
| | |
| | | return ResultUtil.error("登录失败"); |
| | | } |
| | | String phone = json.getJSONObject("data").getString("mobile"); |
| | | |
| | | |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | String nickName = this.getDefaultName(); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | }else{ |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setNickName(this.getDefaultName()); |
| | | userInfo.setNickName(nickName); |
| | | userInfo.setRegistIp(registIp); |
| | | userInfo.setIsAuth(1); |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setState(1); |
| | | userInfo.setOnconUUID(onconUUID); |
| | | |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | loginWarpper.setPhone(2); |
| | | |
| | | //smsrecordService.saveData(1, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | @Override |
| | |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType) throws Exception { |
| | |
| | | openid = map.get("openid"); |
| | | unionid = map.get("unionid"); |
| | | sessionKey = map.get("sessionKey"); |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | phone = getPhone(sessionKey, encryptedData, iv); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone).eq("state",1).ne("flag",3)); |
| | | if(phone1.size()>0){ |
| | |
| | | }else { |
| | | userInfo = userInfoMapper.queryByOpenid2(openid); |
| | | } |
| | | System.out.println(userInfo); |
| | | if(ToolUtil.isEmpty(phone) && ToolUtil.isNotEmpty(userInfo) && ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | String phone1 = getPhone(sessionKey, encryptedData, iv); |
| | | userInfo.setPhone(phone1); |
| | | userInfoMapper.updateById(userInfo); |
| | | } |
| | | }else{//APP |
| | | userInfo = userInfoMapper.queryByOpenid(openid); |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | nickName = this.getDefaultName(); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | }else{ |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | |
| | | int i =0; |
| | | if(null == userInfo){ |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | String phone2 = getPhone(sessionKey, encryptedData, iv); |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone2).eq("state",1).ne("flag",3)); |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone).eq("state",1).ne("flag",3)); |
| | | if(phone1.size()>0){ |
| | | userInfo = phone1.get(0); |
| | | userInfo.setUnionid(unionid); |
| | |
| | | userInfoMapper.updateById(userInfo); |
| | | i=1; |
| | | }else { |
| | | userInfo.setPhone(phone2); |
| | | userInfo.setPhone(phone); |
| | | } |
| | | }else { |
| | | userInfo.setPhone(phone); |
| | |
| | | userInfo.setRegistIp(registIp); |
| | | userInfo.setSex(sex); |
| | | |
| | | userInfo.setNickName(ToolUtil.isNotEmpty(nickName) ? nickName : this.getDefaultName()); |
| | | userInfo.setNickName(nickName); |
| | | userInfo.setAvatar(avatar); |
| | | userInfo.setOnconUUID(onconUUID); |
| | | |
| | | if(type == 2){ |
| | | userInfo.setAppletsOpenId(openid); |
| | |
| | | } |
| | | //调中台接口查询用户 |
| | | String onconUUID = null; |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | |
| | | if (!b) { |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if (null != userInfo1) { |
| | |
| | | |
| | | |
| | | @Override |
| | | public String addAppUser(String phone, String code, String areaCode) throws Exception { |
| | | public String addAppUser(String phone, String code, String areaCode, String onconUUID) throws Exception { |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | | String nickName = null; |
| | | if (null == userInfo) { |
| | |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | request.setVerify_code(code); |
| | | request.setVerify_code_type("0"); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return null; |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | } |
| | | |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建账号-同步证联开户信息 |
| | | * @param request |
| | | * @return 状态 0 成功 其他失败 |
| | | */ |
| | | public static Integer addAccountInfo(AddAccountInfoRequest request){ |
| | | request.setPartnerId("522700"); |
| | | request.setIndustryCode("100"); |
| | | request.setPayModeId("501101"); |
| | | request.setAccessMode("APP"); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/addAccountInfo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【创建账号-同步证联开户信息】请求地址:" + url); |
| | | log.info("【创建账号-同步证联开户信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【创建账号-同步证联开户信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【创建账号-同步证联开户信息】请求失败:" + jsonObject.getString("retMsg")); |
| | | return -1; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | return object.getInteger("status"); |
| | | } |
| | | } |
| | |
| | | public QianYunTongConfig getQianYunTongConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.appkey = "10001104"; |
| | | this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; |
| | | this.privateKeyPath = "E:\\项目文档\\黔云通\\private_key_test.pem"; |
| | | this.userName = "xiaofei"; |
| | | this.status = "1"; |
| | | this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 18:45 |
| | | */ |
| | | @Data |
| | | public class AddAccountInfoRequest { |
| | | /** |
| | | * 易信编号 |
| | | * (个人帐号传onconuuid, |
| | | * 企业帐号传企业编号) |
| | | */ |
| | | private String custId; |
| | | /** |
| | | * 帐号编号 |
| | | */ |
| | | private String accountNo; |
| | | /** |
| | | * 帐户名称 |
| | | */ |
| | | private String accountName; |
| | | /** |
| | | * 租户标识: 黔南-522700 |
| | | */ |
| | | private String partnerId; |
| | | /** |
| | | * 场景编号:网约车-100 |
| | | */ |
| | | private String industryCode; |
| | | /** |
| | | * 支付方式: 501101 |
| | | */ |
| | | private String payModeId; |
| | | /** |
| | | * 支付模式: APP |
| | | */ |
| | | private String accessMode; |
| | | /** |
| | | * 司机手机号 |
| | | */ |
| | | private String mobile; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.MessageBody; |
| | | import com.zlpay.assist.encrypt.sm4.SM4Util; |
| | | import com.zlpay.assist.sign.sm2.SM2Util; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/28 14:25 |
| | | */ |
| | | @Slf4j |
| | | public class CallbackUtil { |
| | | |
| | | private static ZhengLianConfig zhengLianConfig = SpringContextsUtil.getBean(ZhengLianConfig.class).getZhengLianConfig(); |
| | | |
| | | |
| | | public static String callback(MessageBody messageBody) { |
| | | try { |
| | | String data = messageBody.getData(); |
| | | String sign = messageBody.getSign(); |
| | | String secret = messageBody.getSecret(); |
| | | //加密对称加密的秘钥 |
| | | // 获取公钥 |
| | | String publicKey = ZhengLianUtil.getPublicKey(); |
| | | // 验签 |
| | | boolean checkResult = SM2Util.verify(publicKey, zhengLianConfig.getEncrpNo(), sign, data); |
| | | System.out.println("验签结果:" + checkResult); |
| | | // 获取私钥 |
| | | String privateKey = ZhengLianUtil.getPrivateKey(); |
| | | // 解密对称秘钥 |
| | | String k = SM2Util.decrypt(privateKey, secret); |
| | | System.out.println("对称秘钥:" + k); |
| | | // 解密业务报文 |
| | | String backData = SM4Util.sm4EcbDecrypt(k, data); |
| | | System.out.println("业务报文:" + backData); |
| | | return backData; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.MessageBody; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest; |
| | | import com.zlpay.assist.encrypt.sm4.SM4Util; |
| | | import com.zlpay.assist.sign.sm2.SM2Util; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 14:06 |
| | | */ |
| | | @Slf4j |
| | | public class TokenUtil { |
| | | |
| | | private static ZhengLianConfig zhengLianConfig = SpringContextsUtil.getBean(ZhengLianConfig.class).getZhengLianConfig(); |
| | | |
| | | |
| | | public static String getToken(TokenRequest tokenRequest) throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | Map<String,String> headerMap = new HashMap<String,String>(); |
| | | MessageBody body = new MessageBody(); |
| | | headerMap.put("msgId", UUIDUtil.getRandomCode()); |
| | | headerMap.put("merchNo", zhengLianConfig.getMerchNo()); |
| | | headerMap.put("txCode", "ZLPAY.ACC.T0001"); |
| | | headerMap.put("version", "1.0.1"); |
| | | headerMap.put("signa", "1"); |
| | | headerMap.put("signNo", zhengLianConfig.getSignNo()); |
| | | headerMap.put("encrp", "1"); |
| | | headerMap.put("encrpNo", zhengLianConfig.getEncrpNo()); |
| | | headerMap.put("timestamp", sdf.format(new Date())); |
| | | log.info("【证联获取token】请求头报文:"+JSON.toJSONString(headerMap)); |
| | | |
| | | tokenRequest.setAppId(zhengLianConfig.getAppid()); |
| | | String reqBO = JSON.toJSONString(tokenRequest); |
| | | log.info("【证联获取token】请求体报文:"+reqBO); |
| | | // 生成对称加密秘钥 |
| | | String key = ZhengLianUtil.generateKey(16); |
| | | // 加密数据 |
| | | String jsonData = SM4Util.sm4EcbEncrypt(key, reqBO, "NoPadding"); |
| | | //加密对称加密的秘钥 |
| | | // 获取公钥 |
| | | String publicKey = ZhengLianUtil.getPublicKey(); |
| | | String secrtKey = SM2Util.encrypt(publicKey, key); |
| | | |
| | | // 将密文放入body |
| | | body.setData(jsonData); |
| | | body.setSign(ZhengLianUtil.sign(jsonData)); |
| | | body.setSecret(secrtKey); |
| | | log.info("【证联获取token】请求体密文报文:"+JSON.toJSONString(body)); |
| | | String result = ZLHttpClientUtil.doPost(zhengLianConfig.getUrl(), headerMap, JSON.toJSONString(body)); |
| | | |
| | | log.info("【证联获取token】应答内容:"+ result); |
| | | MessageBody respBody = JSON.parseObject(result,MessageBody.class); |
| | | // 验签 |
| | | boolean checkResult = SM2Util.verify(publicKey, zhengLianConfig.getEncrpNo(), respBody.getSign(), respBody.getData()); |
| | | log.info("【证联获取token】验签结果:" + checkResult); |
| | | // 获取私钥 |
| | | String privateKey = ZhengLianUtil.getPrivateKey(); |
| | | // 解密对称秘钥 |
| | | String k = SM2Util.decrypt(privateKey, respBody.getSecret()); |
| | | log.info("【证联获取token】对称秘钥:" + k); |
| | | // 解密业务报文 |
| | | String backData = SM4Util.sm4EcbDecrypt(k, respBody.getData()); |
| | | log.info("【证联获取token】返回业务报文:" + backData); |
| | | JSONObject jsonObject = JSON.parseObject(backData); |
| | | String sysRtnCode = jsonObject.getString("sysRtnCode"); |
| | | if(!"000000".equals(sysRtnCode)){ |
| | | log.error("【证联获取token】获取token失败!{}", jsonObject.getString("sysRtnMsg")); |
| | | throw new Exception(jsonObject.getString("sysRtnMsg")); |
| | | } |
| | | JSONObject bizData = jsonObject.getJSONObject("bizData"); |
| | | String resCode = bizData.getString("resCode"); |
| | | if(!"S010000".equals(resCode)){ |
| | | log.error("【证联获取token】获取token失败!{}", bizData.getString("resMsg")); |
| | | throw new Exception(jsonObject.getString("resMsg")); |
| | | } |
| | | JSONObject resData = bizData.getJSONObject("resData"); |
| | | return resData.getString("token"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import org.apache.http.client.config.AuthSchemes; |
| | | import org.apache.http.client.config.CookieSpecs; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.config.Registry; |
| | | import org.apache.http.config.RegistryBuilder; |
| | | import org.apache.http.conn.socket.ConnectionSocketFactory; |
| | | import org.apache.http.conn.socket.PlainConnectionSocketFactory; |
| | | import org.apache.http.conn.ssl.NoopHostnameVerifier; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509TrustManager; |
| | | import java.io.IOException; |
| | | import java.security.KeyManagementException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Arrays; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/28 14:23 |
| | | */ |
| | | public class ZLHttpClientUtil { |
| | | |
| | | /** |
| | | * 连接超时时间 |
| | | */ |
| | | private final static int CONNECT_TIMEOUT = 30000; |
| | | /** |
| | | * 请求超时时间 |
| | | */ |
| | | private final static int REQUEST_TIMEOUT = 50000; |
| | | /** |
| | | * socket超时时间 |
| | | */ |
| | | private final static int SOCKET_TIMEOUT = 50000; |
| | | /** |
| | | * 请求格式 |
| | | */ |
| | | private final static String FORMAT = "application/json"; |
| | | /** |
| | | * 请求类型 |
| | | */ |
| | | private final static String POST_TYPE = "https://"; |
| | | |
| | | public static String doPost(String url, Map<String, String> headerMap, String jsonData) { |
| | | CloseableHttpClient httpClient = HttpClients.createDefault(); |
| | | if (url != null && url.startsWith(POST_TYPE)) { |
| | | httpClient = sslClient(); |
| | | } |
| | | HttpPost httpPost = new HttpPost(url); |
| | | RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT) |
| | | .setConnectionRequestTimeout(REQUEST_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).setRedirectsEnabled(true) |
| | | .build(); |
| | | httpPost.setConfig(requestConfig); |
| | | httpPost.setHeader("Content-Type", "application/json"); |
| | | if (headerMap != null) { |
| | | Set<String> keys = headerMap.keySet(); |
| | | for (Iterator<String> i = keys.iterator(); i.hasNext();) { |
| | | String key = (String) i.next(); |
| | | httpPost.addHeader(key, headerMap.get(key)); |
| | | } |
| | | } |
| | | try { |
| | | httpPost.setEntity(new StringEntity(jsonData, ContentType.create(FORMAT, "UTF-8"))); |
| | | CloseableHttpResponse execute = httpClient.execute(httpPost); |
| | | int statusCode = execute.getStatusLine().getStatusCode(); |
| | | if (statusCode == 200) { |
| | | return String.valueOf(EntityUtils.toString(execute.getEntity())); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (null != httpClient) { |
| | | try { |
| | | httpClient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static CloseableHttpClient sslClient() { |
| | | try { |
| | | X509TrustManager trustManager = new X509TrustManager() { |
| | | @Override public X509Certificate[] getAcceptedIssuers() { |
| | | return null; |
| | | } |
| | | @Override public void checkClientTrusted(X509Certificate[] xcs, String str) {} |
| | | @Override public void checkServerTrusted(X509Certificate[] xcs, String str) {} |
| | | }; |
| | | SSLContext ctx = SSLContext.getInstance(SSLConnectionSocketFactory.TLS); |
| | | ctx.init(null, new TrustManager[] { trustManager }, null); |
| | | SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE); |
| | | // 创建Registry |
| | | RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD_STRICT) |
| | | .setExpectContinueEnabled(Boolean.TRUE).setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.NTLM,AuthSchemes.DIGEST)) |
| | | .setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC)).build(); |
| | | Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create() |
| | | .register("http", PlainConnectionSocketFactory.INSTANCE) |
| | | .register("https",socketFactory).build(); |
| | | // 创建ConnectionManager,添加Connection配置信息 |
| | | PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry); |
| | | CloseableHttpClient closeableHttpClient = HttpClients.custom().setConnectionManager(connectionManager) |
| | | .setDefaultRequestConfig(requestConfig).build(); |
| | | return closeableHttpClient; |
| | | } catch (KeyManagementException ex) { |
| | | throw new RuntimeException(ex); |
| | | } catch (NoSuchAlgorithmException ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/8 11:31 |
| | | */ |
| | | @Data |
| | | @Component |
| | | public class ZhengLianConfig { |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String activeProfile; |
| | | /** |
| | | * 接口地址 |
| | | */ |
| | | private String url; |
| | | /** |
| | | * appid |
| | | */ |
| | | private String appid; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | private String merchNo; |
| | | /** |
| | | * 加密证书序列号 |
| | | */ |
| | | private String encrpNo; |
| | | /** |
| | | * 签名证书序列号 |
| | | */ |
| | | private String signNo; |
| | | /** |
| | | * 证书 |
| | | */ |
| | | private String cer; |
| | | /** |
| | | * 证书 |
| | | */ |
| | | private String sm2; |
| | | /** |
| | | * |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 获取不同环境的配置 |
| | | * @return |
| | | */ |
| | | public ZhengLianConfig getZhengLianConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.url = "https://gatewaytest.zqpay.com"; |
| | | this.appid = "7ba66c0bc9111c141f8de92d0f095273"; |
| | | this.merchNo = "B00000871"; |
| | | this.encrpNo = "1055490595"; |
| | | this.signNo = "1066348524"; |
| | | this.cer = "E:\\项目文档\\黔云通\\UAT-demo-公用\\1055490595.cer"; |
| | | this.sm2 = "E:\\项目文档\\黔云通\\UAT-demo-公用\\871_111111.sm2"; |
| | | this.password = "111111"; |
| | | } |
| | | if("test".equals(activeProfile)){ |
| | | this.url = "https://gatewaytest.zqpay.com"; |
| | | this.appid = "7ba66c0bc9111c141f8de92d0f095273"; |
| | | this.merchNo = "B00000871"; |
| | | this.encrpNo = "1055490595"; |
| | | this.signNo = "1066348524"; |
| | | this.cer = "/etraffic/server/1055490595.cer"; |
| | | this.sm2 = "/etraffic/server/871_111111.sm2"; |
| | | this.password = "111111"; |
| | | } |
| | | if("prod".equals(activeProfile)){ |
| | | this.url = "https://gateway.zqpay.com"; |
| | | this.appid = "3e06da1751ec1626b30f7703a088f298"; |
| | | this.merchNo = "B00000402"; |
| | | this.encrpNo = "1342935640"; |
| | | this.signNo = "1471742568"; |
| | | this.cer = "/etraffic/server/1342935640.cer"; |
| | | this.sm2 = "/etraffic/server/1342935640.sm2"; |
| | | this.password = "31028Mky"; |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.MessageBody; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TradeTerminalInfo; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.ZLUserInfo; |
| | | import com.zlpay.assist.encrypt.sm4.SM4Util; |
| | | import com.zlpay.assist.sign.sm2.SM2Cert; |
| | | import com.zlpay.assist.sign.sm2.SM2Util; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.RandomStringUtils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/28 14:22 |
| | | */ |
| | | @Slf4j |
| | | public class ZhengLianUtil { |
| | | |
| | | private static ZhengLianConfig zhengLianConfig = SpringContextsUtil.getBean(ZhengLianConfig.class).getZhengLianConfig(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | * @param appUserId |
| | | * @param tradeTerminalInfo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static ZLUserInfo getUserInfo(String appUserId, TradeTerminalInfo tradeTerminalInfo) throws Exception { |
| | | log.info("正联配置信息:{}", JSON.toJSONString(zhengLianConfig)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | Map<String,String> headerMap = new HashMap<String,String>(); |
| | | MessageBody body = new MessageBody(); |
| | | headerMap.put("msgId", UUIDUtil.getRandomCode()); |
| | | headerMap.put("merchNo", zhengLianConfig.getMerchNo()); |
| | | headerMap.put("txCode", "ZLPAY.ACC.T0009"); |
| | | headerMap.put("version", "1.0.1"); |
| | | headerMap.put("signa", "1"); |
| | | headerMap.put("signNo", zhengLianConfig.getSignNo()); |
| | | headerMap.put("encrp", "1"); |
| | | headerMap.put("encrpNo", zhengLianConfig.getEncrpNo()); |
| | | headerMap.put("timestamp", sdf.format(new Date())); |
| | | log.info("【证联获取用户信息】请求头报文:"+JSON.toJSONString(headerMap)); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appId", zhengLianConfig.getAppid()); |
| | | map.put("appUserId", appUserId); |
| | | map.put("tradeTerminalInfo", tradeTerminalInfo); |
| | | String reqBO = JSON.toJSONString(map); |
| | | log.info("【证联获取用户信息】请求体报文:"+reqBO); |
| | | // 生成对称加密秘钥 |
| | | String key = ZhengLianUtil.generateKey(16); |
| | | // 加密数据 |
| | | String jsonData = SM4Util.sm4EcbEncrypt(key, reqBO, "NoPadding"); |
| | | //加密对称加密的秘钥 |
| | | // 获取公钥 |
| | | String publicKey = ZhengLianUtil.getPublicKey(); |
| | | String secrtKey = SM2Util.encrypt(publicKey, key); |
| | | |
| | | // 将密文放入body |
| | | body.setData(jsonData); |
| | | body.setSign(ZhengLianUtil.sign(jsonData)); |
| | | body.setSecret(secrtKey); |
| | | log.info("【证联获取用户信息】请求体密文报文:"+JSON.toJSONString(body)); |
| | | String result = ZLHttpClientUtil.doPost(zhengLianConfig.getUrl(), headerMap, JSON.toJSONString(body)); |
| | | |
| | | log.info("【证联获取用户信息】应答内容:"+ result); |
| | | MessageBody respBody = JSON.parseObject(result,MessageBody.class); |
| | | // 验签 |
| | | boolean checkResult = SM2Util.verify(publicKey, zhengLianConfig.getEncrpNo(), respBody.getSign(), respBody.getData()); |
| | | log.info("【证联获取用户信息】验签结果:" + checkResult); |
| | | // 获取私钥 |
| | | String privateKey = ZhengLianUtil.getPrivateKey(); |
| | | // 解密对称秘钥 |
| | | String k = SM2Util.decrypt(privateKey, respBody.getSecret()); |
| | | log.info("【证联获取用户信息】对称秘钥:" + k); |
| | | // 解密业务报文 |
| | | String backData = SM4Util.sm4EcbDecrypt(k, respBody.getData()); |
| | | log.info("【证联获取用户信息】返回业务报文:" + backData); |
| | | JSONObject jsonObject = JSON.parseObject(backData); |
| | | String sysRtnCode = jsonObject.getString("sysRtnCode"); |
| | | if(!"000000".equals(sysRtnCode)){ |
| | | log.error("【证联获取用户信息】查询用户信息失败!{}", jsonObject.getString("sysRtnMsg")); |
| | | throw new Exception(jsonObject.getString("sysRtnMsg")); |
| | | } |
| | | JSONObject bizData = jsonObject.getJSONObject("bizData"); |
| | | String resCode = bizData.getString("resCode"); |
| | | if("F010900".equals(resCode)){ |
| | | return null; |
| | | } |
| | | if(!"S010000".equals(resCode)){ |
| | | log.error("【证联获取用户信息】查询用户信息失败!{}", bizData.getString("resMsg")); |
| | | throw new Exception(jsonObject.getString("resMsg")); |
| | | } |
| | | JSONObject resData = bizData.getJSONObject("resData"); |
| | | ZLUserInfo zlUserInfo = resData.toJavaObject(ZLUserInfo.class); |
| | | return zlUserInfo; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description: 从公钥证书获取公钥串 |
| | | * @return |
| | | * @return String |
| | | * @throws |
| | | * @author: tsl |
| | | * @date: 2019年4月19日 下午9:07:56 |
| | | */ |
| | | public static String getPublicKey() { |
| | | String publicKey = ""; |
| | | FileInputStream inputStream = null; |
| | | try { |
| | | inputStream = new FileInputStream(new File(zhengLianConfig.getCer())); |
| | | X509Certificate publicCert = SM2Cert.getPublicCert(inputStream); |
| | | publicKey = Base64.getEncoder().encodeToString(publicCert.getEncoded()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (inputStream != null) { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return publicKey; |
| | | } |
| | | |
| | | /** |
| | | * @Description: 从私钥证书获取私钥传 |
| | | * @return |
| | | * @return String |
| | | * @throws |
| | | * @author: tsl |
| | | * @date: 2019年4月19日 下午9:08:00 |
| | | */ |
| | | public static String getPrivateKey() { |
| | | String privateKey = ""; |
| | | FileInputStream inputStream = null; |
| | | try { |
| | | inputStream = new FileInputStream(new File(zhengLianConfig.getSm2())); |
| | | byte[] priBytes = SM2Cert.getPrivateCert(inputStream); |
| | | privateKey = SM2Cert.getPrivateKey(zhengLianConfig.getPassword(), priBytes); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (inputStream != null) { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return privateKey; |
| | | } |
| | | /** |
| | | * @Description: 生成对称加密秘钥 |
| | | * @return String |
| | | * @throws |
| | | * @author: syuf |
| | | * @date: 2018年11月8日 下午5:50:05 |
| | | */ |
| | | public static String generateKey(int length) { |
| | | return RandomStringUtils.randomAlphanumeric(length); |
| | | } |
| | | /** |
| | | * @Description: 签名 |
| | | * @param data |
| | | * @return String |
| | | * @throws |
| | | * @author: syuf |
| | | * @date: 2018年11月15日 下午2:19:01 |
| | | */ |
| | | public static String sign(String data) { |
| | | try { |
| | | // 获取私钥 |
| | | String privateKey = getPrivateKey(); |
| | | return com.zlpay.assist.sign.sm2.SM2Util.sign(privateKey, zhengLianConfig.getSignNo(), data); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/28 14:19 |
| | | */ |
| | | @Data |
| | | public class MessageBody { |
| | | /** |
| | | * 业务数据 |
| | | */ |
| | | private String data; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 秘钥 |
| | | */ |
| | | private String secret; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/28 14:18 |
| | | */ |
| | | @Data |
| | | public class OpenAccountCallbackRequest { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 15:06 |
| | | */ |
| | | @Data |
| | | public class TokenRequest { |
| | | /** |
| | | * 应用appid |
| | | */ |
| | | private String appId; |
| | | /** |
| | | * APP 端用户唯一标识 |
| | | */ |
| | | private String appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String userName; |
| | | /** |
| | | * 证件号码 |
| | | */ |
| | | private String certNo; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 访问类型 |
| | | * 01 证联收银台支付 |
| | | * 04 HOME 页 |
| | | * 06 申请免密签约 |
| | | * 07 商户收银台支付 |
| | | * 08 开户(绑卡) |
| | | * 09 开通支付账户 |
| | | * 10 打开付款码 |
| | | */ |
| | | private String type; |
| | | /** |
| | | * 终端信息域 |
| | | */ |
| | | private TradeTerminalInfo tradeTerminalInfo; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 15:10 |
| | | */ |
| | | @Data |
| | | public class TradeTerminalInfo { |
| | | /** |
| | | * 用于标识交易设 备 公 网 IP地 址 |
| | | */ |
| | | private String ip; |
| | | /** |
| | | * 终端类型: |
| | | * 0:web |
| | | * 1:ANDROID |
| | | * 2:IOS |
| | | * 3:其它 |
| | | */ |
| | | private String terminal; |
| | | /** |
| | | * 用于标识交易设备 MAC 地址 |
| | | */ |
| | | private String mac; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/8/5 10:10 |
| | | */ |
| | | @Data |
| | | public class ZLUserInfo { |
| | | /** |
| | | * appid |
| | | */ |
| | | private String appId; |
| | | /** |
| | | * APP端用户唯一标识 |
| | | */ |
| | | private String appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String userName; |
| | | /** |
| | | * 证件号码 |
| | | */ |
| | | private String certNo; |
| | | /** |
| | | * 证联客户号 |
| | | */ |
| | | private String custId; |
| | | /** |
| | | * 是否已开通支付账户 |
| | | * 1:是 |
| | | * 0:否 |
| | | */ |
| | | private Integer accOpenFlag; |
| | | } |
| | |
| | | max-request-size: 100MB |
| | | max-file-size: 100MB |
| | | redis: |
| | | host: 192.168.110.80 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| | | database: 0 |
| | |
| | | eureka: |
| | | client: |
| | | service-url: #注册中心地址 |
| | | defaultZone: http://sinata:sinata@192.168.110.15:8000/eureka #启用身份验证的方式连接 |
| | | defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 |
| | | register-with-eureka: true #在注册中心进行注册 |
| | | fetch-registry: true #从Eureka中获取注册信息。 |
| | | |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://192.168.110.80:3306/qyttravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://127.0.0.1:3306/qyttravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 123456 |
| | | db-name: qyttravel #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | |
| | | #spring: |
| | | # datasource: |
| | | # url: jdbc:mysql://172.21.35.140:8066/traffic_scdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: traffic_scusr |
| | | # password: QYT_sc@20#25 |
| | | # db-name: traffic_scdb #用来搜集数据库的所有表 |
| | | # filters: wall,mergeStat |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://192.168.110.80:27017/traveling_track |
| | | uri: mongodb://127.0.0.1:27017/traveling_track |
| | | |
| | | |
| | | --- |
| | |
| | | appKey: 111 # |
| | | |
| | | qyt: |
| | | socket_uri: http://192.168.110.111:6000 |
| | | socket_uri: http://127.0.0.1:6000 |
| | | |
| | | --- |
| | | |
| | |
| | | server: |
| | | port: 8006 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | server: |
| | | port: 8006 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |
| | |
| | | //import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | //import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | //import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | //import com.stylefeng.guns.modular.system.util.qianyuntong.AESUtils; |
| | | //import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | //import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | //import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // Integer orderId = 163; |
| | | // Integer score = 5; |
| | | // Integer userId = 17; |
| | | // String content = ""; |
| | | // Integer driverId = 37; |
| | | // try { |
| | | // Evaluate evaluate=new Evaluate(); |
| | | // evaluate.setAddTime(new Date()); |
| | | // evaluate.setType(8); |
| | | // evaluate.setOrderId(orderId); |
| | | // evaluate.setScore(score); |
| | | // evaluate.setUserId(userId); |
| | | // if(ToolUtil.isNotEmpty(content)){ |
| | | // /*判断评价内容是否包含敏感词*/ |
| | | // List<SensitiveWords> list = sensitiveWordsMapper.selectList(null); |
| | | // Set<String> sensitiveWordSet = new HashSet<>(); |
| | | // for(SensitiveWords gs:list){ |
| | | // sensitiveWordSet.add(gs.getContent()); |
| | | // } |
| | | // SensitiveWordUtil.init(sensitiveWordSet); |
| | | // boolean result = SensitiveWordUtil.contains(content); |
| | | // |
| | | // } |
| | | // evaluate.setContent(content); |
| | | // evaluate.setDriverId(driverId); |
| | | // /*查询用户手机号*/ |
| | | // UserInfo userInfo=userInfoService.selectById(userId); |
| | | // if(userInfo!=null){ |
| | | // evaluate.setUserPhone(userInfo.getPhone()); |
| | | // } |
| | | // /*查询司机电话*/ |
| | | // DriverRide driverRide=driverRideService.selectById(driverId); |
| | | // if(driverRide!=null){ |
| | | // /*计算司机的评分*/ |
| | | // driverRide.setEvaluateNum((null != driverRide.getEvaluateNum() ? driverRide.getEvaluateNum() : 0 )+1); |
| | | // driverRide.setEvaluateScore((null == driverRide.getEvaluateScore() ? 0 : driverRide.getEvaluateScore())+score); |
| | | // driverRideService.updateById(driverRide); |
| | | // } |
| | | // /*标记订单已评价*/ |
| | | // OrderRide orderTaxi=new OrderRide(); |
| | | // orderTaxi.setId(orderId); |
| | | // orderTaxi.setIsEvaluate(2); |
| | | // orderTaxi.setEvaluateScoreUser(score); |
| | | // orderTaxi.setContent(content); |
| | | // orderRideService.updateById(orderTaxi); |
| | | // evaluateService.insert(evaluate); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | // request.setMobile("15828353222"); |
| | | // request.setEncryptType("aesbase64"); |
| | | // request.setPassword(AESUtils.encryptBase64("123456")); |
| | | // request.setNickname("测试"); |
| | | //// request.setVerify_code(code); |
| | | //// request.setVerify_code_type("0"); |
| | | // RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | // System.err.println(register); |
| | | // } |
| | | //} |
| | |
| | | eureka: |
| | | client: |
| | | service-url: #注册中心地址 |
| | | defaultZone: http://sinata:sinata@192.168.110.106:8000/eureka #启用身份验证的方式连接 |
| | | defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 |
| | | register-with-eureka: true #在注册中心进行注册 |
| | | fetch-registry: true #从Eureka中获取注册信息。 |
| | | |
| | |
| | | routes: |
| | | user-server: #接口调用路由服务,名字任意取。(用户端服务) |
| | | path: /user/** #配置请求URL的请求规则 |
| | | url: http://192.168.110.80:7006 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | url: http://127.0.0.1:8006 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | serviceid: user-server #指定Eureka注册中心的服务id |
| | | driver-server: #路由司机相关请求 |
| | | path: /driver/** #配置请求URL的请求规则 |
| | | url: http://192.168.110.80:7007 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | url: http://127.0.0.1:8007 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | serviceid: driver-server #指定Eureka注册中心的服务id |
| | | dispatch-server: #路由调度相关请求 |
| | | path: /dispatch/** #配置请求URL的请求规则 |
| | | url: http://192.168.110.80:7008 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | url: http://127.0.0.1:8008 #真正的微服务地址,path匹配的请求都转发到这里 |
| | | serviceid: dispatch-server #指定Eureka注册中心的服务id |
| | | # 配置zuul超时时间 |
| | | host: |
| | |
| | | server: |
| | | port: 5000 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | spring: |
| | | profiles: |
| | |
| | | server: |
| | | port: 5000 |
| | | tomcat: |
| | | basedir: /etraffic/server/chuxing/tomcat |
| | | |
| | | spring: |
| | | profiles: |