门店号管理bug

master
LegnaYet 6 years ago
parent 6e734cc461
commit d43ff7bbc7

@ -32,7 +32,7 @@ public class WxCpConfiguration {
private static Map<Integer, WxCpService> cpServices = Maps.newHashMap();
public static Integer APPLICATIONID = 1000043;
public static Integer APPLICATIONID = 1000004;
@Autowired
private BasicConfigDOMapper basicConfigDOMapper;
@ -44,12 +44,12 @@ public class WxCpConfiguration {
@PostConstruct
public void initServices() {
QueryWrapper<BasicConfigDO> baseParams = new QueryWrapper<>();
baseParams.eq("code","CP_CORPID");
baseParams.eq("code","HT_CP_CORPID");
BasicConfigDO basicConfigDO = basicConfigDOMapper.selectOne(baseParams);
QueryWrapper<BasicConfigDO> confParams = new QueryWrapper<>();
confParams.likeRight("code","CP_");
confParams.ne("code","CP_CORPID");
confParams.likeRight("code","HT_CP_");
confParams.ne("code","HT_CP_CORPID");
List<BasicConfigDO> confConfigDO = basicConfigDOMapper.selectList(confParams);
Map<String,Map<String,String>> confMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(confConfigDO)){

@ -19,7 +19,9 @@ import com.kiisoo.ic.wx.entity.FollowUserDTO;
import com.kiisoo.ic.wx.entity.FollowUserTag;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpExternalContactService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpUserExternalContactInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -350,8 +352,9 @@ public class WxResponseService {
case "add_external_contact":
// state字段需要企业成员验证添加后回调给到
NodeList stateNode = root.getElementsByTagName("State");
String state = "";
if(stateNode.getLength() > 0) {
String state = stateNode.item(0).getTextContent();
state = stateNode.item(0).getTextContent();
log.info(state);
}
log.info("add_external_contact 配置了客户联系功能的成员添加外部联系人时,回调该事件");
@ -360,7 +363,7 @@ public class WxResponseService {
String res = WeixinApi.getExternalContactInfo(externalUserID);
log.info(res);
//添加客户并添加店铺企业微信信息
addExternalContact(res);
addExternalContact(res,state);
// welcomeCodeNode = root.getElementsByTagName("WelcomeCode");
// welcomeCode = welcomeCodeNode.item(0).getTextContent();
@ -417,11 +420,18 @@ public class WxResponseService {
* @param
* @return
*/
public OpCustomerEnterpriseWechat analyticCustomerEnterprise(String res){
public OpCustomerEnterpriseWechat analyticCustomerEnterprise(String res) throws WxErrorException {
JSONObject parseObject = JSON.parseObject(res);
//解析企业微信信息
OpCustomerEnterpriseWechat ocew = JSONObject.parseObject(parseObject.getString("external_contact"), OpCustomerEnterpriseWechat.class);
List<FollowUserDTO> fUserDTO = JSONObject.parseArray(parseObject.getString("follow_user"),FollowUserDTO.class);
WxCpService cpService = WxCpConfiguration.getCpService(APPLICATIONID);
WxCpExternalContactService externalContactService = cpService.getExternalContactService();
WxCpUserExternalContactInfo contactDetail = externalContactService.getContactDetail(ocew.getExternalUserid());
if (contactDetail!=null && contactDetail.getExternalContact()!=null && StringUtils.isNotBlank(contactDetail.getExternalContact().getUnionId())){
ocew.setUnionid(contactDetail.getExternalContact().getUnionId());
}
if (CollectionUtils.isNotEmpty(fUserDTO)){
ocew.setUserid(fUserDTO.get(0).getUserid());
ocew.setRemark(fUserDTO.get(0).getRemark());
@ -446,10 +456,12 @@ public class WxResponseService {
*
* @param res
*/
public void addExternalContact(String res){
public void addExternalContact(String res,String state) throws WxErrorException {
OpCustomerEnterpriseWechat ocew = analyticCustomerEnterprise(res);
ocew.setState(state);
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setUniId(ocew.getUnionid());
customerDTO.setExternalUserid(ocew.getExternalUserid());
if (StringUtils.isNotBlank(ocew.getState())){
//解析state 店铺code-导购
String[] split = ocew.getState().split("-");
@ -476,7 +488,7 @@ public class WxResponseService {
*
* @param res
*/
public void editExternalContact(String res){
public void editExternalContact(String res) throws WxErrorException {
OpCustomerEnterpriseWechat ocew = analyticCustomerEnterprise(res);
CustomerModifyDTO customerModifyDTO= new CustomerModifyDTO();
customerModifyDTO.setUniId(ocew.getUnionid());

@ -70,6 +70,7 @@
where t1.domain_id = t2.domain_id
and t2.entity_id = t3.id
and t2.type = 3
and
<choose>
<when test="customerIds != null and customerIds.size > 0">
and t1.org_id in

@ -29,6 +29,7 @@
</select>
<select id="selectShopManagerByShop" resultType="java.lang.String">
select staff_code from poi_store_staff where store_id = #{shopId} and status = 1 and type = 1
limit 1
</select>
<select id="selectInfoById" resultType="com.kiisoo.ic.webappmy.vo.StafferInfoVO">

Loading…
Cancel
Save