no message
This commit is contained in:
@ -9,6 +9,7 @@ import com.sczx.sync.mapper.CompanyStoreMapper;
|
||||
import com.sczx.sync.service.SendDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -68,6 +69,7 @@ public class SendDataController {
|
||||
return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// @ApiOperation(value = "接收需同步数据接口")
|
||||
// @GetMapping("/companyinfo")
|
||||
|
||||
@ -27,6 +27,8 @@ public interface CompanyInfoMapper extends BaseMapper<CompanyInfo> {
|
||||
*/
|
||||
CompanyInfo selectByOpId(@Param("bOpId") Long bOpId);
|
||||
|
||||
|
||||
CompanyInfo selectByCompanyName(CompanyInfo companyInfo);
|
||||
/**
|
||||
* 根据电话号码更新公司信息
|
||||
* @param companyInfo 公司信息
|
||||
@ -34,6 +36,8 @@ public interface CompanyInfoMapper extends BaseMapper<CompanyInfo> {
|
||||
*/
|
||||
int updateByPhone(CompanyInfo companyInfo);
|
||||
|
||||
int updateByCompanyName(CompanyInfo companyInfo);
|
||||
|
||||
int updateByOpId(CompanyInfo companyInfo);
|
||||
|
||||
/**
|
||||
|
||||
@ -36,6 +36,10 @@ public class CompanyInfo implements Serializable {
|
||||
* 城市信息
|
||||
*/
|
||||
private String citys;
|
||||
|
||||
private Long company_id;
|
||||
|
||||
private Long operator_id;
|
||||
|
||||
/**
|
||||
* 是否删除标记 (0-未删除, 1-已删除)
|
||||
@ -140,4 +144,20 @@ public class CompanyInfo implements Serializable {
|
||||
public void setSyncTime(LocalDateTime syncTime) {
|
||||
this.syncTime = syncTime;
|
||||
}
|
||||
|
||||
public Long getCompany_id() {
|
||||
return company_id;
|
||||
}
|
||||
|
||||
public void setCompany_id(Long company_id) {
|
||||
this.company_id = company_id;
|
||||
}
|
||||
|
||||
public Long getOperator_id() {
|
||||
return operator_id;
|
||||
}
|
||||
|
||||
public void setOperator_id(Long operator_id) {
|
||||
this.operator_id = operator_id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ public class StoreInfo implements Serializable {
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
private Long store_id;
|
||||
|
||||
|
||||
private Long bpStoreId;
|
||||
@ -190,4 +191,20 @@ public class StoreInfo implements Serializable {
|
||||
public void setIs_delete(String is_delete) {
|
||||
this.is_delete = is_delete;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getStore_id() {
|
||||
return store_id;
|
||||
}
|
||||
|
||||
public void setStore_id(Long store_id) {
|
||||
this.store_id = store_id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,8 +281,8 @@ public class ReceiveServiceImpl implements ReceiveService {
|
||||
map.put("code", "500");
|
||||
return map;
|
||||
}
|
||||
if (companyInfo.getbOpId() == null) {
|
||||
map.put("msg", "租电平台运营商id不能为空,请补传'bOpId'");
|
||||
if (companyInfo.getOperator_id() == null) {
|
||||
map.put("msg", "租电平台运营商id不能为空,请补传'operator_id'");
|
||||
map.put("code", "500");
|
||||
return map;
|
||||
}
|
||||
@ -292,10 +292,10 @@ public class ReceiveServiceImpl implements ReceiveService {
|
||||
//
|
||||
// }
|
||||
|
||||
if (companyInfoMapper.selectByOpId(companyInfo.getbOpId()) != null) {
|
||||
if (companyInfoMapper.selectByOpId(companyInfo.getOperator_id()) != null) {
|
||||
companyInfoMapper.updateByOpId(companyInfo);
|
||||
} else if (companyInfoMapper.selectByPhone(companyInfo.getPhone()) != null) {
|
||||
companyInfoMapper.updateByPhone(companyInfo);
|
||||
} else if (companyInfoMapper.selectByCompanyName(companyInfo.getCompany_name()) != null) {
|
||||
companyInfoMapper.updateByCompanyName(companyInfo);
|
||||
} else {
|
||||
companyInfoMapper.insertCompanyInfo(companyInfo);
|
||||
}
|
||||
@ -368,13 +368,13 @@ public class ReceiveServiceImpl implements ReceiveService {
|
||||
map.put("code", "500");
|
||||
return map;
|
||||
}
|
||||
if (storeInfo.getBpStoreId() == null) {
|
||||
map.put("msg", "租电平台门店id不能为空,请补传'bpStoreId'");
|
||||
if (storeInfo.getStore_id() == null) {
|
||||
map.put("msg", "租电平台门店id不能为空,请补传'store_id'");
|
||||
map.put("code", "500");
|
||||
return map;
|
||||
}
|
||||
|
||||
if (companyStoreMapper.selectByBid(storeInfo.getBpStoreId()) != null) {
|
||||
if (companyStoreMapper.selectByBid(storeInfo.getStore_id()) != null) {
|
||||
companyStoreMapper.updateByBid(storeInfo);
|
||||
} else if (companyStoreMapper.selectByPhone(storeInfo.getPhone()) != null) {
|
||||
companyStoreMapper.updateByName(storeInfo);
|
||||
|
||||
@ -138,12 +138,14 @@ public class SendDataServiceImpl implements SendDataService {
|
||||
}
|
||||
|
||||
CompanyInfo companyInfo = new CompanyInfo();
|
||||
companyInfo.setOperator_id(id);
|
||||
companyInfo.setCompany_name(company.getCompany_name());
|
||||
companyInfo.setContact_name(company.getContact_name());
|
||||
companyInfo.setPhone(company.getPhone());
|
||||
companyInfo.setAddress(company.getAddress());
|
||||
companyInfo.setIs_delete(company.getIsDelete().toString());
|
||||
|
||||
|
||||
// 使用 Set 去除重复城市
|
||||
Set<String> uniqueCities = new HashSet<>();
|
||||
if (storeInfoList != null && !storeInfoList.isEmpty()) {
|
||||
@ -154,9 +156,13 @@ public class SendDataServiceImpl implements SendDataService {
|
||||
}
|
||||
}
|
||||
|
||||
// 拼接去重后的城市字符串
|
||||
String citysStr = String.join(",", uniqueCities);
|
||||
companyInfo.setCitys(citysStr);
|
||||
if (citysStr.isEmpty() || citysStr.length() == 0){
|
||||
companyInfo.setCitys(company.getCitys());
|
||||
}else{
|
||||
companyInfo.setCitys(citysStr);
|
||||
}
|
||||
|
||||
|
||||
SyncRequest syncRequest = new SyncRequest();
|
||||
syncRequest.setData(companyInfo);
|
||||
@ -220,6 +226,8 @@ public class SendDataServiceImpl implements SendDataService {
|
||||
map.put("code","500");
|
||||
}
|
||||
|
||||
storeInfo.setStore_id(id);
|
||||
|
||||
SyncRequest syncRequest = new SyncRequest();
|
||||
syncRequest.setData(storeInfo);
|
||||
if(saveRecord(syncRequest,URL+"/storeinfo",id,"storeinfo")){
|
||||
|
||||
@ -28,6 +28,14 @@
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectByCompanyName" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_company
|
||||
WHERE company_name = #{company_name}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
@ -40,7 +48,7 @@
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_company
|
||||
WHERE b_op_id = #{bOpId}
|
||||
WHERE b_op_id = #{operator_id}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
@ -79,13 +87,45 @@
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="bOpId != null">
|
||||
b_op_id = #{bOpId},
|
||||
b_op_id = #{operator_id},
|
||||
</if>
|
||||
phone = #{phone}
|
||||
</set>
|
||||
WHERE phone = #{phone}
|
||||
</update>
|
||||
|
||||
<update id="updateByCompanyName" parameterType="com.sczx.sync.po.CompanyInfo" >
|
||||
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
|
||||
SELECT
|
||||
id
|
||||
from zc_company
|
||||
where company_name = #{company_name}
|
||||
</selectKey>
|
||||
UPDATE zc_company
|
||||
<set>
|
||||
<if test="company_name != null and company_name != ''">
|
||||
company_name = #{company_name},
|
||||
</if>
|
||||
<if test="contact_name != null and contact_name != ''">
|
||||
contact_name = #{contact_name},
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
address = #{address},
|
||||
</if>
|
||||
<if test="citys != null and citys != ''">
|
||||
citys = #{citys},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="bOpId != null">
|
||||
b_op_id = #{operator_id},
|
||||
</if>
|
||||
phone = #{phone}
|
||||
</set>
|
||||
WHERE company_name = #{company_name}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据电话号码更新公司信息 -->
|
||||
<update id="updateByOpId" parameterType="com.sczx.sync.po.CompanyInfo">
|
||||
@ -117,7 +157,7 @@
|
||||
</if>
|
||||
phone = #{phone}
|
||||
</set>
|
||||
WHERE b_op_id = #{bOpId}
|
||||
WHERE b_op_id = #{operator_id}
|
||||
</update>
|
||||
|
||||
<!-- 插入公司信息 -->
|
||||
@ -137,7 +177,7 @@
|
||||
ali_receiving_account,
|
||||
ali_key
|
||||
) VALUES (
|
||||
#{bOpId},
|
||||
#{operator_id},
|
||||
#{company_name},
|
||||
#{contact_name},
|
||||
#{phone},
|
||||
|
||||
Reference in New Issue
Block a user