Commit f6cc88bb authored by hezhen's avatar hezhen

Merge branch 'master-tiande' into dev-tiande

parents c6569d98 93d39ad0
package com.xxfc.platform.tour.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Table(name = "branch_company")
public class BranchCompany {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
@Column(name = "company_base_id")
@ApiModelProperty("主键id")
private Integer companyBaseId;
@Column(name = "company_id")
@ApiModelProperty("公司id")
private Long companyId;
/**
* 分公司名称
*/
@ApiModelProperty("分公司名称")
private String name;
@Column(name = "short_name")
@ApiModelProperty("简称")
private String shortName;
/**
* 分支机构类型
*/
@Column(name = "branch_type")
@ApiModelProperty("分支机构类型")
private Integer branchType;
/**
* 分支机构所属机构
*/
@Column(name = "subordinate_branch")
@ApiModelProperty("分支机构所属机构")
private Integer subordinateBranch;
/**
* 地址-省/直辖市(编码)
*/
@Column(name = "addr_province")
@ApiModelProperty("地址-省/直辖市(编码)")
private Integer addrProvince;
/**
* 地址-省/直辖市(编码)名称
*/
@Column(name = "province_name")
@ApiModelProperty("地址-省/直辖市(编码)名称")
private String provinceName;
/**
* 地址-市(编码)
*/
@Column(name = "addr_city")
@ApiModelProperty("地址-市(编码)")
private Integer addrCity;
/**
* 地址-市(编码)名称
*/
@Column(name = "city_name")
@ApiModelProperty("地址-市(编码名称")
private String cityName;
/**
* 地址-镇/县(编码)
*/
@Column(name = "addr_town")
@ApiModelProperty("地址-镇/县(编码)")
private Integer addrTown;
/**
* 地址-县名称
*/
@Column(name = "town_name")
@ApiModelProperty("县名称")
private String townName;
/**
* 详细地址
*/
@Column(name = "addr_detail")
@ApiModelProperty("详细地址")
private String addrDetail;
private Date createTime;
private Date updateTime;
/**
* 负责人
*/
@ApiModelProperty("负责人")
private String leader;
/**
* 负责人联系方式
*/
@ApiModelProperty("负责人联系方式")
private String leaderContactInfo;
/**
* 分公司状态
*/
@ApiModelProperty("分公司状态")
private Integer status;
/**
*公司地址-纬度
*/
@ApiModelProperty("公司地址-纬度")
private BigDecimal latitude;
/**
* 公司地址-经度
*/
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
private String companyPic;
private Integer zoneId;
private String phone;
/**
* 租车客服电话
*/
@Column(name = "vehice_service_phone")
@ApiModelProperty("租车客服电话")
private String vehiceServicePhone;
/**
* 旅游客服电话
*/
@Column(name = "tour_service_phone")
@ApiModelProperty("旅游客服电话")
private String tourServicePhone;
/**
* 上下架:1-上架;2-下架
*/
private Integer state;
/**
* 是否app展示:1-是;2-否
*/
@Column(name = "is_show")
private Integer isShow;
/**
* 是否删除:0-正常;1-删除
*/
@Column(name = "is_del")
private Integer isDel;
}
\ No newline at end of file
package com.xxfc.platform.tour.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Table(name = "company_info")
public class CompanyInfo {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("公司名称")
private String name;
@ApiModelProperty("法人姓名")
@Column(name = "legal_person")
private String legalPerson;
@ApiModelProperty("公司名称")
@Column(name = "legal_id_number")
private String legalIdNumber;
@ApiModelProperty("联系人")
private String contact;
@ApiModelProperty("联系电话")
private String mobile;
@ApiModelProperty("营业执照")
@Column(name = "business_license")
private String businessLicense;
@Column(name = "crt_time")
private Long crtTime;
@Column(name = "upd_time")
private Long updTime;
@Column(name = "is_del")
private Integer isDel;
}
\ No newline at end of file
......@@ -25,6 +25,11 @@
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-universal-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......
package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.tour.entity.BranchCompany;
import com.xxfc.platform.tour.mapper.BranchCompanyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany>{
public ObjectRestResponse addOrUpd(BranchCompany branchCompany){
Long id = branchCompany.getId() == null ? 0L :branchCompany.getId();
BranchCompany branchCompany1=selectById(id);
if (branchCompany1 != null){
updateSelectiveById(branchCompany);
}else {
insertSelective(branchCompany);
}
return ObjectRestResponse.succ();
}
}
package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.tour.entity.CompanyInfo;
import com.xxfc.platform.tour.mapper.CompanyInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
public ObjectRestResponse addOrUpd(CompanyInfo companyInfo){
Long id = companyInfo.getId() == null ? 0L :companyInfo.getId();
CompanyInfo companyInfo1=selectById(id);
if (companyInfo1 != null){
updateSelectiveById(companyInfo);
}else {
insertSelective(companyInfo);
}
return ObjectRestResponse.succ();
}
}
package com.xxfc.platform.tour.config;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitCommonConfig;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
*
* @author zhoujw
* @date 2019/7/15
*/
@Configuration
public class RabbitTourConfig extends RabbitCommonConfig {
//同步企业信息
public static final String CORPORATION_UPD_QUEUE = "tourCorporation:upd.queue";
//同步门店信息
public static final String COMPANY_UPD_QUEUE = "tourCompany:upd.queue";
static {
myQueue = new ArrayList<BindDTO>() {{
//企业
add(new BindDTO(CORPORATION_UPD_QUEUE, VEHICLE_TOPIC, KEY_CORPORATION_UPD));
//门店
add(new BindDTO(COMPANY_UPD_QUEUE, VEHICLE_TOPIC, KEY_COMPANY_UPD));
}};
}
}
package com.xxfc.platform.tour.handler;
import cn.hutool.json.JSONUtil;
import com.rabbitmq.client.Channel;
import com.xxfc.platform.tour.biz.BranchCompanyBiz;
import com.xxfc.platform.tour.entity.BranchCompany;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.xxfc.platform.tour.config.RabbitTourConfig.*;
@Component
@Slf4j
public class BranchCompanyMQHandler {
@Autowired
BranchCompanyBiz branchCompanyBiz;
/**
* 同步门店信息
* @param
*/
@RabbitListener(queues = COMPANY_UPD_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
log.info("同步门店信息 messageJson:"+ JSONUtil.parse(message));
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
BranchCompany branchCompany = JSONUtil.toBean(msg, BranchCompany.class);
branchCompanyBiz.addOrUpd(branchCompany);
executorService.shutdown();
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
channel.basicAck(deliveryTag, false);
} catch (Exception e) {
log.info("接收到的消息失败");
try {
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} catch (IOException i) {
log.error(e.getMessage(), i);
}
log.error(e.getMessage(), e);
}
}
});
}
}
package com.xxfc.platform.tour.handler;
import cn.hutool.json.JSONUtil;
import com.rabbitmq.client.Channel;
import com.xxfc.platform.tour.biz.CompanyInfoBiz;
import com.xxfc.platform.tour.entity.CompanyInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.xxfc.platform.tour.config.RabbitTourConfig.*;
@Component
@Slf4j
public class CorporationMQHandler {
@Autowired
CompanyInfoBiz companyInfoBiz;
/**
* 同步企业信息
* @param
*/
@RabbitListener(queues = CORPORATION_UPD_QUEUE)
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
log.info("同步企业信息 messageJson:"+ JSONUtil.parse(message));
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
CompanyInfo companyInfo = JSONUtil.toBean(msg, CompanyInfo.class);
companyInfoBiz.addOrUpd(companyInfo);
executorService.shutdown();
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
channel.basicAck(deliveryTag, false);
} catch (Exception e) {
log.info("接收到的消息失败");
try {
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} catch (IOException i) {
log.error(e.getMessage(), i);
}
log.error(e.getMessage(), e);
}
}
});
}
}
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.BranchCompany;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdListMapper<BranchCompany,Integer> {
}
\ No newline at end of file
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.CompanyInfo;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyInfoMapper extends Mapper<CompanyInfo>, SelectByIdListMapper<CompanyInfo,Long> {
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment