no message

This commit is contained in:
2025-08-27 01:36:27 +08:00
parent fcffced718
commit 2fc96102a6
22 changed files with 1711 additions and 47 deletions

View File

@ -81,6 +81,12 @@ public class Result<T> implements Serializable {
return ok(map); return ok(map);
} }
public static Result ok(String code, String msg, String issue,String key, Object value) {
Map<String, Object> map = new HashMap(1);
map.put(key, value);
return builder().code(code).success(true).msg(msg).issue(issue).data(map).build();
}
public static Result fail(String msg) { public static Result fail(String msg) {
return result((IApiCode)ApiErrorCode.FAIL, msg, msg, (Object)null); return result((IApiCode)ApiErrorCode.FAIL, msg, msg, (Object)null);
} }

View File

@ -35,7 +35,7 @@ public class ReceiveBatteryController {
@ApiOperation(value = "接收租电数据接口") @ApiOperation(value = "接收租电数据接口")
@PostMapping("/batterymeal") @PostMapping("/batterymeal")
public Result batterymeal(@RequestBody String receiveMealReq){ public Result batteryMeal(@RequestBody String receiveMealReq){
Boolean bool = receiveService.recceiveMeals(receiveMealReq); Boolean bool = receiveService.recceiveMeals(receiveMealReq);
if (!bool.booleanValue()){ if (!bool.booleanValue()){
return Result.fail(NOT_PERMISSION); return Result.fail(NOT_PERMISSION);
@ -43,6 +43,35 @@ public class ReceiveBatteryController {
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "接收用户数据接口")
@PostMapping("/userinfo")
public Result userInfo(@RequestBody String receiveMealReq){
String code = receiveService.recceiveUserInfo(receiveMealReq);
if (code.equals(NOT_PERMISSION.getCode())){
return Result.fail(NOT_PERMISSION);
}
return Result.ok("200","操作成功","操作成功","Cid",code);
}
@ApiOperation(value = "接收运营商数据接口")
@PostMapping("/companyinfo")
public Result companyInfo(@RequestBody String receiveMealReq){
String code = receiveService.recceiveCompanyInfo(receiveMealReq);
if (code.equals(NOT_PERMISSION.getCode())){
return Result.fail(NOT_PERMISSION);
}
return Result.ok("200","操作成功","操作成功","Cid",code);
}
@ApiOperation(value = "接收门店数据接口")
@PostMapping("/storeinfo")
public Result storeInfo(@RequestBody String receiveMealReq){
String code = receiveService.recceiveStoreInfo(receiveMealReq);
if (code.equals(NOT_PERMISSION.getCode())){
return Result.fail(NOT_PERMISSION);
}
return Result.ok("200","操作成功","操作成功","Cid",code);
}

View File

@ -0,0 +1,163 @@
package com.sczx.sync.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户信息实体类
*/
public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 微信unionid
*/
private String wxunionid;
/**
* 我的微信unionid
*/
private String mywxunionid;
/**
* 手机号
*/
private String phone;
/**
* 是否认证
*/
private Integer isauthentication;
/**
* 姓名
*/
private String name;
/**
* 身份证号
*/
private String cardno;
/**
* 身份证正面
*/
private String card1;
/**
* 身份证反面
*/
private String card2;
/**
* 是否商户
*/
private Integer ismerchant;
/**
* 运营商ID
*/
private String operatorId;
/**
* 门店ID
*/
private String storeId;
private LocalDateTime syncTime;
public LocalDateTime getSyncTime() {
return syncTime;
}
public void setSyncTime(LocalDateTime syncTime) {
this.syncTime = syncTime;
}
public String getWxunionid() {
return wxunionid;
}
public void setWxunionid(String wxunionid) {
this.wxunionid = wxunionid;
}
public String getMywxunionid() {
return mywxunionid;
}
public void setMywxunionid(String mywxunionid) {
this.mywxunionid = mywxunionid;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getIsauthentication() {
return isauthentication;
}
public void setIsauthentication(Integer isauthentication) {
this.isauthentication = isauthentication;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCardno() {
return cardno;
}
public void setCardno(String cardno) {
this.cardno = cardno;
}
public String getCard1() {
return card1;
}
public void setCard1(String card1) {
this.card1 = card1;
}
public String getCard2() {
return card2;
}
public void setCard2(String card2) {
this.card2 = card2;
}
public Integer getIsmerchant() {
return ismerchant;
}
public void setIsmerchant(Integer ismerchant) {
this.ismerchant = ismerchant;
}
public String getOperatorId() {
return operatorId;
}
public void setOperatorId(String operatorId) {
this.operatorId = operatorId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
}

View File

@ -0,0 +1,39 @@
package com.sczx.sync.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.sync.po.BaseUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 租车用户信息 Mapper 接口
*/
@Mapper
public interface BaseUserMapper extends BaseMapper<BaseUser> {
/**
* 根据手机号查询用户
* @param phoneNumber 手机号
* @return 用户信息
*/
BaseUser selectByPhoneNumber(@Param("phoneNumber") String phoneNumber);
/**
* 插入用户信息
* @param user 用户信息
* @return 影响行数
*/
int insertBaseUser(BaseUser user);
/**
* 根据手机号更新用户信息
* @param user 用户信息
* @return 影响行数
*/
int updateByPhoneNumber(BaseUser user);
}

View File

@ -1,13 +1,13 @@
package com.sczx.sync.mapper; package com.sczx.sync.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.sync.po.SyncDataInfo; import com.sczx.sync.po.BatteryRule;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface BatteryMealMapper extends BaseMapper<SyncDataInfo> { public interface BatteryMealMapper extends BaseMapper<BatteryRule> {
int insertZcRentBatteyRule(SyncDataInfo syncDataInfo); int insertZcRentBatteyRule(BatteryRule batteryRule);
int updateBatteryRule(SyncDataInfo syncDataInfo); int updateBatteryRule(BatteryRule batteryRule);
} }

View File

@ -0,0 +1,50 @@
package com.sczx.sync.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.sync.po.CompanyInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 公司信息 Mapper 接口
*/
@Mapper
public interface CompanyInfoMapper extends BaseMapper<CompanyInfo> {
/**
* 根据电话号码查询公司信息
* @param phone 电话号码
* @return 公司信息
*/
CompanyInfo selectByPhone(@Param("phone") String phone);
/**
* 根据opid查询公司信息
* @param bOpId 电话号码
* @return 公司信息
*/
CompanyInfo selectByOpId(@Param("bOpId") Long bOpId);
/**
* 根据电话号码更新公司信息
* @param companyInfo 公司信息
* @return 影响行数
*/
int updateByPhone(CompanyInfo companyInfo);
int updateByOpId(CompanyInfo companyInfo);
/**
* 插入公司信息
* @param companyInfo 公司信息
* @return 影响行数
*/
int insertCompanyInfo(CompanyInfo companyInfo);
/**
* 根据公司名称查询公司信息
* @param companyName 公司名称
* @return 公司信息
*/
CompanyInfo selectByCompanyName(@Param("companyName") String companyName);
}

View File

@ -1,13 +1,45 @@
package com.sczx.sync.mapper; package com.sczx.sync.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.sync.po.StoreInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface CompanyStoreMapper { public interface CompanyStoreMapper extends BaseMapper<StoreInfo> {
int updateStoreId(long bpStoreId, long cId); int updateStoreId(long bpStoreId, long cId);
int updateOpeId(long bOpId, long cId); int updateOpeId(long bOpId, long cId);
int updateOdId(long bOdId, long cId); int updateOdId(long bOdId, long cId);
/**
* 根据联系电话查询门店信息
* @param phone 联系电话
* @return 门店信息
*/
StoreInfo selectByPhone(@Param("phone") String phone);
StoreInfo selectByBid(@Param("bpStoreId") Long bpStoreId);
/**
* 根据门店名称更新门店信息
* @param storeInfo 门店信息
* @return 影响行数
*/
int updateByName(StoreInfo storeInfo);
int updateByBid(StoreInfo storeInfo);
/**
* 插入门店信息
* @param storeInfo 门店信息
* @return 影响行数
*/
int insertStoreInfo(StoreInfo storeInfo);
} }

View File

@ -0,0 +1,34 @@
package com.sczx.sync.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sczx.sync.po.UserStore;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 用户与门店信息 Mapper 接口
*/
@Mapper
public interface UserStoreMapper extends BaseMapper<UserStore> {
/**
* 根据用户ID查询用户门店信息
* @param userId 用户ID
* @return 用户门店信息
*/
UserStore selectByUserId(@Param("userId") Long userId);
/**
* 根据用户ID更新用户门店信息
* @param userStore 用户门店信息
* @return 影响行数
*/
int updateByUserId(UserStore userStore);
/**
* 插入用户门店信息
* @param userStore 用户门店信息
* @return 影响行数
*/
int insertUserStore(UserStore userStore);
}

View File

@ -0,0 +1,295 @@
package com.sczx.sync.po;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 租车用户信息实体类
*/
@TableName("zc_base_user")
public class BaseUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户id主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户名
*/
@TableField("user_name")
private String userName;
/**
* 头像
*/
@TableField("avatar_url")
private String avatarUrl;
/**
* 密码
*/
@TableField("password")
private String password;
/**
* 手机号
*/
@TableField("phone_number")
private String phoneNumber;
/**
* 角色id
*/
@TableField("role_id")
private Integer roleId;
/**
* 是否门店用户1是0否
*/
@TableField("is_store")
private Integer isStore;
/**
* 昵称
*/
@TableField("nick_name")
private String nickName;
/**
* 微信小程序 openid
*/
@TableField("wechat_openid")
private String wechatOpenid;
/**
* 运营商ID
*/
@TableField("operator_id")
private Integer operatorId;
/**
* 门店ID
*/
@TableField("store_id")
private Integer storeId;
/**
* 支付宝小程序 userid
*/
@TableField("alipay_userid")
private String alipayUserid;
/**
* 是否认证,0未认证1已认证
*/
@TableField("authed")
private Integer authed;
/**
* 身份证号
*/
@TableField("id_no")
private String idNo;
/**
* 真实姓名
*/
@TableField("real_name")
private String realName;
/**
* 正面照片
*/
@TableField("front_photo")
private String frontPhoto;
/**
* 反面照片
*/
@TableField("back_photo")
private String backPhoto;
/**
* 删除标志0代表存在 2代表删除
*/
@TableField("del_flag")
private String delFlag;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAvatarUrl() {
return avatarUrl;
}
public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getIsStore() {
return isStore;
}
public void setIsStore(Integer isStore) {
this.isStore = isStore;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getWechatOpenid() {
return wechatOpenid;
}
public void setWechatOpenid(String wechatOpenid) {
this.wechatOpenid = wechatOpenid;
}
public Integer getOperatorId() {
return operatorId;
}
public void setOperatorId(Integer operatorId) {
this.operatorId = operatorId;
}
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public String getAlipayUserid() {
return alipayUserid;
}
public void setAlipayUserid(String alipayUserid) {
this.alipayUserid = alipayUserid;
}
public Integer getAuthed() {
return authed;
}
public void setAuthed(Integer authed) {
this.authed = authed;
}
public String getIdNo() {
return idNo;
}
public void setIdNo(String idNo) {
this.idNo = idNo;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getFrontPhoto() {
return frontPhoto;
}
public void setFrontPhoto(String frontPhoto) {
this.frontPhoto = frontPhoto;
}
public String getBackPhoto() {
return backPhoto;
}
public void setBackPhoto(String backPhoto) {
this.backPhoto = backPhoto;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -7,7 +7,7 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@TableName("zc_rent_battey_rule") @TableName("zc_rent_battey_rule")
public class SyncDataInfo implements Serializable { public class BatteryRule implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableField("id") @TableField("id")
private Long id; private Long id;
@ -35,7 +35,7 @@ public class SyncDataInfo implements Serializable {
private Integer categoryId; private Integer categoryId;
@TableField("operator_id") @TableField("operator_id")
private Integer operatorId; private Integer operatorId;
private LocalDateTime syncTime;
public LocalDateTime getSyncTime() { public LocalDateTime getSyncTime() {
return syncTime; return syncTime;
} }
@ -44,7 +44,7 @@ public class SyncDataInfo implements Serializable {
this.syncTime = syncTime; this.syncTime = syncTime;
} }
private LocalDateTime syncTime;
// Getters and Setters // Getters and Setters
public void setId(Long id) { this.id = id;} public void setId(Long id) { this.id = id;}

View File

@ -0,0 +1,113 @@
package com.sczx.sync.po;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class CompanyInfo implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long bOpId;
/**
* 公司名称
*/
private String companyName;
/**
* 联系人姓名
*/
private String contactName;
/**
* 电话号码
*/
private String phone;
/**
* 地址
*/
private String address;
/**
* 城市信息
*/
private String citys;
/**
* 是否删除标记 (0-未删除, 1-已删除)
*/
private Integer isDelete;
/**
* 同步时间
*/
private LocalDateTime syncTime;
public Long getbOpId() {
return bOpId;
}
public void setbOpId(Long bOpId) {
this.bOpId = bOpId;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCitys() {
return citys;
}
public void setCitys(String citys) {
this.citys = citys;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public LocalDateTime getSyncTime() {
return syncTime;
}
public void setSyncTime(LocalDateTime syncTime) {
this.syncTime = syncTime;
}
}

View File

@ -0,0 +1,169 @@
package com.sczx.sync.po;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 门店信息实体类
*/
@Data
public class StoreInfo implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 门店名称
*/
private String name;
/**
* 联系人姓名
*/
private String contactName;
/**
* 联系电话
*/
private String phone;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 区域
*/
private String area;
/**
* 详细地址
*/
private String address;
/**
* 门店图片
*/
private String image;
/**
* 纬度
*/
private Double latitude;
/**
* 经度
*/
private Double longitude;
/**
* 是否删除标记 (0-未删除, 1-已删除)
*/
private Integer isDelete;
private Long bpStoreId;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Long getBpStoreId() {
return bpStoreId;
}
public void setBpStoreId(Long bpStoreId) {
this.bpStoreId = bpStoreId;
}
}

View File

@ -3,7 +3,7 @@ package com.sczx.sync.po;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
public class SyncRequest implements Serializable { public class SyncRequest<T> implements Serializable { // 添加泛型参数 <T>
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String appid; private String appid;
@ -11,7 +11,7 @@ public class SyncRequest implements Serializable {
private String accessToken; private String accessToken;
@TableField("Data") @TableField("Data")
private SyncDataInfo data; private T data; // 将 SyncDataInfo 改为 T
// Getters and Setters // Getters and Setters
public String getAppid() { public String getAppid() {
@ -30,13 +30,11 @@ public class SyncRequest implements Serializable {
this.accessToken = accessToken; this.accessToken = accessToken;
} }
public SyncDataInfo getData() { public T getData() { // 返回类型改为 T
return data; return data;
} }
public void setData(SyncDataInfo data) { public void setData(T data) { // 参数类型改为 T
this.data = data; this.data = data;
} }
} }

View File

@ -0,0 +1,141 @@
package com.sczx.sync.po;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户与门店信息实体类
*/
@TableName("zc_base_user_store")
public class UserStore implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
@TableField("user_id")
private Long userId;
/**
* 运营商ID
*/
@TableField("operator_id")
private Long operatorId;
/**
* 门店ID
*/
@TableField("store_id")
private Long storeId;
/**
* 删除标志0代表存在 2代表删除
*/
@TableField("del_flag")
private String delFlag;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getOperatorId() {
return operatorId;
}
public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
}
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -1,8 +1,12 @@
package com.sczx.sync.service; package com.sczx.sync.service;
import com.sczx.sync.dto.ReceiveMealReq;
public interface ReceiveService { public interface ReceiveService {
boolean recceiveMeals(String request); boolean recceiveMeals(String request);
String recceiveUserInfo(String request);
String recceiveCompanyInfo(String request);
String recceiveStoreInfo(String request);
} }

View File

@ -1,28 +1,26 @@
package com.sczx.sync.service.impl; package com.sczx.sync.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.common.utils.MD5Utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sczx.sync.dto.DataRceiveReq; import com.sczx.sync.mapper.*;
import com.sczx.sync.dto.ReceiveMealReq; import com.sczx.sync.po.StoreInfo;
import com.sczx.sync.mapper.BatteryMealMapper; import com.sczx.sync.po.CompanyInfo;
import com.sczx.sync.mapper.CompanyStoreMapper; import com.sczx.sync.po.BaseUser;
import com.sczx.sync.mapper.DataReceiveRecordMapper; import com.sczx.sync.po.BatteryRule;
import com.sczx.sync.po.DataReceivePo;
import com.sczx.sync.po.SyncDataInfo;
import com.sczx.sync.po.SyncRequest; import com.sczx.sync.po.SyncRequest;
import com.sczx.sync.entity.UserInfo;
import com.sczx.sync.po.UserStore;
import com.sczx.sync.service.ReceiveService; import com.sczx.sync.service.ReceiveService;
import com.sczx.sync.service.ThirdPartyForwardService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map;
import static com.sczx.sync.common.enums.ApiErrorCode.NOT_PERMISSION;
@Slf4j @Slf4j
@Service @Service
@ -32,7 +30,14 @@ public class ReceiveServiceImpl implements ReceiveService {
@Autowired @Autowired
private BatteryMealMapper batteryMealMapper; private BatteryMealMapper batteryMealMapper;
@Autowired
private BaseUserMapper baseUserMapper;
@Autowired
private UserStoreMapper userStoreMapper;
@Autowired
private CompanyInfoMapper companyInfoMapper;
@Autowired
private CompanyStoreMapper companyStoreMapper;
@Value("${battery-platform.appid}") @Value("${battery-platform.appid}")
private String appId; private String appId;
@ -42,24 +47,116 @@ public class ReceiveServiceImpl implements ReceiveService {
@Override @Override
public boolean recceiveMeals(String request) { public boolean recceiveMeals(String request) {
SyncRequest meals = JSON.parseObject(request, SyncRequest.class); SyncRequest<BatteryRule> syncRequest = JSON.parseObject(request, SyncRequest.class);
if(!meals.getAppid().equals(appId)||!meals.getAccessToken().equals(accessToken)){ if(!syncRequest.getAppid().equals(appId)||!syncRequest.getAccessToken().equals(accessToken)){
return false; return false;
} }
SyncDataInfo syncDataInfo = meals.getData(); BatteryRule batteryRule = syncRequest.getData();
syncDataInfo.setSyncTime(LocalDateTime.now()); batteryRule.setSyncTime(LocalDateTime.now());
QueryWrapper<SyncDataInfo> syncDataInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<BatteryRule> syncDataInfoQueryWrapper = new QueryWrapper<>();
QueryWrapper<SyncDataInfo> eq = syncDataInfoQueryWrapper.eq("meal_id", meals.getData().getMealId()); QueryWrapper<BatteryRule> eq = syncDataInfoQueryWrapper.eq("meal_id", batteryRule.getMealId());
if(batteryMealMapper.selectOne(eq)!=null){
batteryMealMapper.updateBatteryRule(syncDataInfo); if (batteryMealMapper.selectOne(eq) != null) {
}else { batteryMealMapper.updateBatteryRule(batteryRule);
batteryMealMapper.insertZcRentBatteyRule(syncDataInfo); } else {
batteryMealMapper.insertZcRentBatteyRule(batteryRule);
} }
return true; return true;
} }
@Override
public String recceiveUserInfo(String request) {
SyncRequest<UserInfo> syncRequest = JSON.parseObject(request, SyncRequest.class);
if(!syncRequest.getAppid().equals(appId)||!syncRequest.getAccessToken().equals(accessToken)){
return NOT_PERMISSION.getCode();
}
UserInfo user = JSON.parseObject(String.valueOf(syncRequest.getData()), UserInfo.class);
BaseUser baseUser = new BaseUser();
baseUser.setUserName(user.getPhone());
baseUser.setPhoneNumber(user.getPhone());
baseUser.setPassword(MD5Utils.md5Hex(user.getPhone(), "utf8"));
baseUser.setNickName(user.getPhone());
baseUser.setRealName(user.getName());
baseUser.setIdNo(user.getCardno());
baseUser.setAuthed(user.getIsauthentication());
baseUser.setIsStore(user.getIsmerchant());
baseUser.setFrontPhoto(user.getCard1());;
baseUser.setBackPhoto(user.getCard2());
baseUser.setDelFlag("0");
int baseUserId;
//处理baseuser
if (baseUserMapper.selectByPhoneNumber(user.getPhone()) != null) {
baseUserId = baseUserMapper.updateByPhoneNumber(baseUser);
} else {
baseUserId = baseUserMapper.insertBaseUser(baseUser);
}
UserStore userStore = new UserStore();
String storeIds = user.getStoreId();
String[] storeIdsArray = storeIds.split(",");
for (String storeId : storeIdsArray) {
userStore.setStoreId(Long.parseLong(storeId));
userStore.setOperatorId(Long.parseLong(user.getOperatorId()));
userStore.setUserId(Long.parseLong(String.valueOf(baseUserId)));
userStore.setDelFlag("0");
userStore.setCreateTime(LocalDateTime.now());
userStore.setUpdateTime(LocalDateTime.now());
userStoreMapper.insertUserStore(userStore) ;
}
return baseUserId + "";
}
@Override
public String recceiveCompanyInfo(String request) {
SyncRequest<CompanyInfo> syncRequest = JSON.parseObject(request, SyncRequest.class);
if(!syncRequest.getAppid().equals(appId)||!syncRequest.getAccessToken().equals(accessToken)){
return NOT_PERMISSION.getCode();
}
CompanyInfo companyInfo = JSON.parseObject(String.valueOf(syncRequest.getData()), CompanyInfo.class);
if (companyInfoMapper.selectByCompanyName(companyInfo.getCompanyName())!=null){
}
if(companyInfoMapper.selectByOpId(companyInfo.getbOpId()) != null){
companyInfoMapper.updateByOpId(companyInfo);
} else if(companyInfoMapper.selectByPhone(companyInfo.getPhone())!=null){
companyInfoMapper.updateByPhone(companyInfo);
}else {
companyInfoMapper.insertCompanyInfo(companyInfo);
}
return companyInfo.getId() + "";
}
@Override
public String recceiveStoreInfo(String request) {
SyncRequest<StoreInfo> syncRequest = JSON.parseObject(request, SyncRequest.class);
if(!syncRequest.getAppid().equals(appId)||!syncRequest.getAccessToken().equals(accessToken)){
return NOT_PERMISSION.getCode();
}
StoreInfo storeInfo = JSON.parseObject(String.valueOf(syncRequest.getData()), StoreInfo.class);
if(companyStoreMapper.selectByBid(storeInfo.getBpStoreId()) != null){
companyStoreMapper.updateByBid(storeInfo);
} else if(companyStoreMapper.selectByPhone(storeInfo.getPhone())!=null){
companyStoreMapper.updateByName(storeInfo);
}else {
companyStoreMapper.insertStoreInfo(storeInfo);
}
return storeInfo.getId() + "";
}
} }

View File

@ -65,5 +65,5 @@ third-party:
retry-times: 3 retry-times: 3
battery-platform: battery-platform:
appid: 12312321 appid: B202507001
access_token: 23213213 access_token: 6E7C062AC581505438B64574BE7AD887

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sczx.sync.mapper.BaseUserMapper">
<!-- 通用查询结果映射 -->
<resultMap id="BaseResultMap" type="com.sczx.sync.po.BaseUser">
<id column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="avatar_url" property="avatarUrl"/>
<result column="password" property="password"/>
<result column="phone_number" property="phoneNumber"/>
<result column="role_id" property="roleId"/>
<result column="is_store" property="isStore"/>
<result column="nick_name" property="nickName"/>
<result column="wechat_openid" property="wechatOpenid"/>
<result column="operator_id" property="operatorId"/>
<result column="store_id" property="storeId"/>
<result column="alipay_userid" property="alipayUserid"/>
<result column="authed" property="authed"/>
<result column="id_no" property="idNo"/>
<result column="real_name" property="realName"/>
<result column="front_photo" property="frontPhoto"/>
<result column="back_photo" property="backPhoto"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, user_name, avatar_url, phone_number, role_id, is_store, nick_name,id_no
</sql>
<select id="selectByPhoneNumber" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM zc_base_user
WHERE phone_number = #{phoneNumber}
AND del_flag = 0
</select>
<!-- 选择性插入用户信息 -->
<insert id="insertBaseUser" parameterType="com.sczx.sync.po.BaseUser" useGeneratedKeys="true" keyProperty="id">
INSERT INTO zc_base_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null">user_name,</if>
<if test="avatarUrl != null">avatar_url,</if>
<if test="password != null">password,</if>
<if test="phoneNumber != null">phone_number,</if>
<if test="roleId != null">role_id,</if>
<if test="isStore != null">is_store,</if>
<if test="nickName != null">nick_name,</if>
<if test="wechatOpenid != null">wechat_openid,</if>
<if test="operatorId != null">operator_id,</if>
<if test="storeId != null">store_id,</if>
<if test="alipayUserid != null">alipay_userid,</if>
<if test="authed != null">authed,</if>
<if test="idNo != null">id_no,</if>
<if test="realName != null">real_name,</if>
<if test="frontPhoto != null">front_photo,</if>
<if test="backPhoto != null">back_photo,</if>
<if test="delFlag != null">del_flag,</if>
create_time,
update_time,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="userName != null">#{userName},</if>
<if test="avatarUrl != null">#{avatarUrl},</if>
<if test="password != null">#{password},</if>
<if test="phoneNumber != null">#{phoneNumber},</if>
<if test="roleId != null">#{roleId},</if>
<if test="isStore != null">#{isStore},</if>
<if test="nickName != null">#{nickName},</if>
<if test="wechatOpenid != null">#{wechatOpenid},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="storeId != null">#{storeId},</if>
<if test="alipayUserid != null">#{alipayUserid},</if>
<if test="authed != null">#{authed},</if>
<if test="idNo != null">#{idNo},</if>
<if test="realName != null">#{realName},</if>
<if test="frontPhoto != null">#{frontPhoto},</if>
<if test="backPhoto != null">#{backPhoto},</if>
<if test="delFlag != null">#{delFlag},</if>
NOW(),
NOW(),
</trim>
</insert>
<!-- 根据手机号更新用户信息 -->
<update id="updateByPhoneNumber" parameterType="com.sczx.sync.po.BaseUser">
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
SELECT
id
from zc_base_user
where phone_number = #{phoneNumber}
</selectKey>
UPDATE zc_base_user
<set>
<if test="userName != null">user_name = #{userName},</if>
<if test="avatarUrl != null">avatar_url = #{avatarUrl},</if>
<if test="password != null">password = #{password},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="isStore != null">is_store = #{isStore},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="wechatOpenid != null">wechat_openid = #{wechatOpenid},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="storeId != null">store_id = #{storeId},</if>
<if test="alipayUserid != null">alipay_userid = #{alipayUserid},</if>
<if test="authed != null">authed = #{authed},</if>
<if test="idNo != null">id_no = #{idNo},</if>
<if test="realName != null">real_name = #{realName},</if>
<if test="frontPhoto != null">front_photo = #{frontPhoto},</if>
<if test="backPhoto != null">back_photo = #{backPhoto},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
update_time = NOW(),
</set>
WHERE phone_number = #{phoneNumber}
</update>
</mapper>

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sczx.sync.mapper.BatteryMealMapper"> <mapper namespace="com.sczx.sync.mapper.BatteryMealMapper">
<insert id="insertZcRentBatteyRule" parameterType="SyncDataInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertZcRentBatteyRule" parameterType="BatteryRule" useGeneratedKeys="true" keyProperty="id">
insert into zc_rent_battey_rule insert into zc_rent_battey_rule
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if> <if test="title != null and title != ''">title,</if>
@ -38,7 +38,7 @@
</trim> </trim>
</insert> </insert>
<update id="updateBatteryRule" parameterType="SyncDataInfo"> <update id="updateBatteryRule" parameterType="BatteryRule">
update zc_rent_battey_rule update zc_rent_battey_rule
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if> <if test="title != null and title != ''">title = #{title},</if>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sczx.sync.mapper.CompanyInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.sczx.sync.po.CompanyInfo">
<result column="company_name" property="companyName" />
<result column="contact_name" property="contactName" />
<result column="phone" property="phone" />
<result column="address" property="address" />
<result column="citys" property="citys" />
<result column="is_delete" property="isDelete" />
<result column="b_op_id" property="bOpId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
b_op_id, company_name, contact_name, phone, address, citys, is_delete
</sql>
<!-- 根据电话号码查询公司信息 -->
<select id="selectByPhone" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM zc_company
WHERE phone = #{phone}
AND is_delete = 0
</select>
<!-- 根据bOpId查询公司信息 -->
<select id="selectByOpId" parameterType="java.lang.Long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM zc_company
WHERE b_op_id = #{bOpId}
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 = #{companyName}
AND is_delete = 0
</select>
<!-- 根据电话号码更新公司信息 -->
<update id="updateByPhone" parameterType="com.sczx.sync.po.CompanyInfo" >
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
SELECT
id
from zc_company
where phone = #{phone}
</selectKey>
UPDATE zc_company
<set>
<if test="companyName != null and companyName != ''">
company_name = #{companyName},
</if>
<if test="contactName != null and contactName != ''">
contact_name = #{contactName},
</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 = #{bOpId},
</if>
phone = #{phone}
</set>
WHERE phone = #{phone}
</update>
<!-- 根据电话号码更新公司信息 -->
<update id="updateByOpId" parameterType="com.sczx.sync.po.CompanyInfo">
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
SELECT
id
from zc_company
where phone = #{phone}
</selectKey>
UPDATE zc_company
<set>
<if test="companyName != null and companyName != ''">
company_name = #{companyName},
</if>
<if test="contactName != null and contactName != ''">
contact_name = #{contactName},
</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 = #{bOpId},
</if>
phone = #{phone}
</set>
WHERE b_op_id = #{bOpId}
</update>
<!-- 插入公司信息 -->
<insert id="insertCompanyInfo" parameterType="com.sczx.sync.po.CompanyInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO zc_company (
b_op_id,
company_name,
contact_name,
phone,
address,
citys,
is_delete,
is_add_rules,
sharing_ratio,
wechat_receiving_account,
wechat_key,
ali_receiving_account,
ali_key
) VALUES (
#{bOpId},
#{companyName},
#{contactName},
#{phone},
#{address},
#{citys},
#{isDelete},
0,0,0,0,0,0
)
</insert>
</mapper>

View File

@ -2,6 +2,171 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sczx.sync.mapper.CompanyStoreMapper"> <mapper namespace="com.sczx.sync.mapper.CompanyStoreMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.sczx.sync.po.StoreInfo">
<result column="name" property="name" />
<result column="contact_person" property="contactName" />
<result column="phone" property="phone" />
<result column="province_id" property="province" />
<result column="city_id" property="city" />
<result column="area_id" property="area" />
<result column="address" property="address" />
<result column="image" property="image" />
<result column="latitude" property="latitude" />
<result column="longitude" property="longitude" />
<result column="del_flag" property="isDelete" />
<result column="bp_store_id" property="bpStoreId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
bp_store_id, name, contact_person, phone, province_id, city_id, area_id, address, image, latitude, longitude, del_flag
</sql>
<!-- 根据联系电话查询门店信息 -->
<select id="selectByPhone" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM zc_company_store
WHERE phone = #{phone}
AND del_flag = 0
</select>
<select id="selectByBid" parameterType="java.lang.Long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM zc_company_store
WHERE bp_store_id = #{bpStoreId}
AND del_flag = 0
</select>
<!-- 根据门店名称更新门店信息 -->
<update id="updateByName" parameterType="com.sczx.sync.po.StoreInfo">
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
SELECT
id
from zc_company_store
where name = #{name}
</selectKey>
UPDATE zc_company_store
<set>
<if test="contactName != null and contactName != ''">
contact_person = #{contactName},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="province != null and province != ''">
province_id = #{province},
</if>
<if test="city != null and city != ''">
city_id = #{city},
</if>
<if test="area != null and area != ''">
area_id = #{area},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="image != null and image != ''">
image = #{image},
</if>
<if test="latitude != null">
latitude = #{latitude},
</if>
<if test="longitude != null">
longitude = #{longitude},
</if>
<if test="isDelete != null">
del_flag = #{isDelete},
</if>
<if test="bpStoreId != null">
bp_store_id = #{bpStoreId},
</if>
</set>
WHERE name = #{name}
</update>
<update id="updateByBid" parameterType="com.sczx.sync.po.StoreInfo">
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
SELECT
id
from zc_company_store
where bp_store_id = #{bpStoreId}
</selectKey>
UPDATE zc_company_store
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="contactName != null and contactName != ''">
contact_person = #{contactName},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="province != null and province != ''">
province_id = #{province},
</if>
<if test="city != null and city != ''">
city_id = #{city},
</if>
<if test="area != null and area != ''">
area_id = #{area},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="image != null and image != ''">
image = #{image},
</if>
<if test="latitude != null">
latitude = #{latitude},
</if>
<if test="longitude != null">
longitude = #{longitude},
</if>
<if test="isDelete != null">
del_flag = #{isDelete},
</if>
</set>
WHERE bp_store_id = #{bpStoreId}
</update>
<!-- 插入门店信息 -->
<insert id="insertStoreInfo" parameterType="com.sczx.sync.po.StoreInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO zc_company_store (
name,
contact_person,
phone,
province_id,
city_id,
area_id,
address,
image,
latitude,
longitude,
del_flag,
bp_store_id
) VALUES (
#{name},
#{contactName},
#{phone},
#{province},
#{city},
#{area},
#{address},
#{image},
#{latitude},
#{longitude},
#{isDelete},
#{bpStoreId}
)
</insert>
<update id="updateStoreId"> <update id="updateStoreId">
update zc_company_store set bp_store_id = #{bpStoreId} where id =#{cId} update zc_company_store set bp_store_id = #{bpStoreId} where id =#{cId}
</update> </update>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sczx.sync.mapper.UserStoreMapper">
<!-- 通用查询结果映射 -->
<resultMap id="BaseResultMap" type="com.sczx.sync.po.UserStore">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="operator_id" property="operatorId"/>
<result column="store_id" property="storeId"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, operator_id, store_id, del_flag, create_by, create_time, update_by, update_time
</sql>
<!-- 根据用户ID查询用户门店信息 -->
<select id="selectByUserId" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM zc_base_user_store
WHERE user_id = #{userId}
AND del_flag = '0'
</select>
<!-- 根据用户ID更新用户门店信息 -->
<update id="updateByUserId" parameterType="com.sczx.sync.po.UserStore">
UPDATE zc_base_user_store
<set>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="storeId != null">store_id = #{storeId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = NOW(),
</set>
WHERE user_id = #{userId}
</update>
<!-- 插入用户门店信息 -->
<insert id="insertUserStore" parameterType="com.sczx.sync.po.UserStore">
INSERT INTO zc_base_user_store(
user_id,
operator_id,
store_id,
del_flag,
create_by,
create_time,
update_by,
update_time
) VALUES (
#{userId},
#{operatorId},
#{storeId},
#{delFlag},
#{createBy},
NOW(),
#{updateBy},
NOW()
)
</insert>
</mapper>