|
|
@@ -23,6 +23,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.goafanti.common.bo.Error;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
@@ -39,6 +41,9 @@ import com.goafanti.common.dao.TOrderChangeMapper;
|
|
|
import com.goafanti.common.dao.TOrderDetailMapper;
|
|
|
import com.goafanti.common.dao.TOrderMapper;
|
|
|
import com.goafanti.common.dao.TmpTableMapper;
|
|
|
+import com.goafanti.common.dao.UserBusinessMapper;
|
|
|
+import com.goafanti.common.dao.UserFollowBusinessMapper;
|
|
|
+import com.goafanti.common.dao.UserFollowMapper;
|
|
|
import com.goafanti.common.dao.UserLockReleaseMapper;
|
|
|
import com.goafanti.common.dao.UserMapper;
|
|
|
import com.goafanti.common.dao.UserRoleMapper;
|
|
|
@@ -60,6 +65,9 @@ import com.goafanti.common.model.TOrderChange;
|
|
|
import com.goafanti.common.model.TOrderDetail;
|
|
|
import com.goafanti.common.model.TmpTable;
|
|
|
import com.goafanti.common.model.User;
|
|
|
+import com.goafanti.common.model.UserBusiness;
|
|
|
+import com.goafanti.common.model.UserFollow;
|
|
|
+import com.goafanti.common.model.UserFollowBusiness;
|
|
|
import com.goafanti.common.model.UserLockRelease;
|
|
|
import com.goafanti.common.model.UserRole;
|
|
|
import com.goafanti.common.utils.BeanUtilsExt;
|
|
|
@@ -70,7 +78,10 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import com.goafanti.customer.bo.BusinessListBo;
|
|
|
+import com.goafanti.customer.bo.FollowBusinessBo;
|
|
|
import com.goafanti.customer.bo.LockingReleaseBo;
|
|
|
+import com.goafanti.customer.service.CustomerService;
|
|
|
import com.goafanti.order.bo.BillDetailBo;
|
|
|
import com.goafanti.order.bo.BillListBo;
|
|
|
import com.goafanti.order.bo.CommodityDetailBo;
|
|
|
@@ -133,6 +144,12 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
private UserLockReleaseMapper userLockReleaseMapper;
|
|
|
@Autowired
|
|
|
UserRoleMapper userRoleMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserBusinessMapper userBusinessMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserFollowMapper userFollowMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserFollowBusinessMapper userFollowBusinessMapper;
|
|
|
|
|
|
@Value(value = "${mobileRemindCodeTemplate}")
|
|
|
private String mobileRemindCodeTemplate = null;
|
|
|
@@ -1062,24 +1079,26 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
return releaseList;
|
|
|
}
|
|
|
|
|
|
- @SuppressWarnings("unused")
|
|
|
- private void lockProject(TOrder tOrder){
|
|
|
- List<TOrderDetail> list = tOrderMapper.selectOrderCommodity(tOrder.getOrderNo());
|
|
|
- UserLockRelease ulr = null;
|
|
|
- for(TOrderDetail td : list){
|
|
|
- //新增锁定数据
|
|
|
- ulr = new UserLockRelease();
|
|
|
+ private void lockProject(BusinessListBo ub) {
|
|
|
+ UserLockRelease ulr= new UserLockRelease();
|
|
|
ulr.setId(UUID.randomUUID().toString());
|
|
|
ulr.setType(1);
|
|
|
- ulr.setAid(TokenManager.getAdminId());
|
|
|
- ulr.setBusinessProjectId(td.getCommodityId());
|
|
|
- ulr.setLockTime(tOrder.getSignTime());
|
|
|
+ ulr.setAid(/*TokenManager.getAdminId()*/"1");
|
|
|
+ ulr.setBusinessProjectId(ub.getBusinessProjectId());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss " );
|
|
|
+ try {
|
|
|
+ if (null==ub.getCreateTime()) {
|
|
|
+ ulr.setLockTime(new Date());
|
|
|
+ }else {
|
|
|
+ ulr.setLockTime(sdf.parse(ub.getCreateTime()));
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
ulr.setStatus(UserLockReleaseStatus.LOCKED.getCode());
|
|
|
- ulr.setUid(tOrder.getBuyerId());
|
|
|
- ulr.setOrderNo(tOrder.getOrderNo());
|
|
|
+ ulr.setUid(ub.getUid());
|
|
|
userLockReleaseMapper.insert(ulr);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
private void releaseProject(List<LockingReleaseBo> releaseList){
|
|
|
@@ -1998,8 +2017,10 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- mobile=mobile.substring(0, mobile.length()-1);
|
|
|
- sendMessage(tOrder,mobile,OrderFlowState.DDBG.getDesc());
|
|
|
+ if(mobile.length()>1){
|
|
|
+ mobile=mobile.substring(0, mobile.length()-1);
|
|
|
+ sendMessage(tOrder,mobile,OrderFlowState.DDBG.getDesc());
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -2046,4 +2067,72 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int addBusinessProjectId(FollowBusinessBo fbb) {
|
|
|
+ //if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error(ErrorConstants.AT_LEAST_A_BUSINESS,"",""));
|
|
|
+ //更新跟进记录表
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
|
|
|
+ fbb.setFollowTime(format.format(new Date()));
|
|
|
+ UserFollow userFollow = new UserFollow();
|
|
|
+ String followId = UUID.randomUUID().toString();
|
|
|
+ userFollow.setId(followId);
|
|
|
+ userFollow.setAid(TokenManager.getAdminId());
|
|
|
+ userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
|
|
|
+ userFollow.setEffective(DeleteStatus.UNDELETE.getCode());
|
|
|
+ userFollow.setCreateTime(new Date());
|
|
|
+ userFollow.setOcbId(fbb.getOcbId());
|
|
|
+ userFollow.setResult(fbb.getResult());
|
|
|
+ userFollow.setUid(fbb.getUid());
|
|
|
+ int followCount = userBusinessMapper.selectFollowCountByUAid(fbb.getUid(), TokenManager.getAdminId()) + 1;
|
|
|
+ userFollow.setFollowCount(followCount);
|
|
|
+ userFollowMapper.insert(userFollow);
|
|
|
+ //检查客户锁定情况
|
|
|
+ if(fbb.getUserBusinessList().size()>0){
|
|
|
+ String ufbId = "";
|
|
|
+ UserBusiness userBusiness = null;
|
|
|
+ UserFollowBusiness userFollowBusiness = null;
|
|
|
+ for(BusinessListBo ub: fbb.getUserBusinessList()){
|
|
|
+ userBusiness = new UserBusiness();
|
|
|
+ userFollowBusiness = new UserFollowBusiness();
|
|
|
+ ufbId = UUID.randomUUID().toString();
|
|
|
+ if (ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
|
|
|
+ if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
|
|
|
+ userLockReleaseMapper.updateProject(fbb.getUid(), /*TokenManager.getAdminId()*/"1", ub.getBusinessProjectId());
|
|
|
+ lockProject(ub);//锁定客户业务
|
|
|
+ }
|
|
|
+ String ubId = UUID.randomUUID().toString();
|
|
|
+ //更新业务表
|
|
|
+ userBusiness.setId(ubId);
|
|
|
+ userBusiness.setBusinessProjectId(ub.getBusinessProjectId());
|
|
|
+ try {
|
|
|
+ userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
|
|
|
+ userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ userBusiness.setCustomerStatus(ub.getCustomerStatus());
|
|
|
+ userBusiness.setFollowSituation(ub.getFollowSituation());
|
|
|
+ userBusiness.setUid(fbb.getUid());
|
|
|
+ userBusiness.setAid(TokenManager.getAdminId());
|
|
|
+ userBusiness.setRemarks(ub.getRemarks());
|
|
|
+ userBusinessMapper.insert(userBusiness);
|
|
|
+ //更新业务中间表
|
|
|
+ userFollowBusiness.setBusinessId(ubId);
|
|
|
+ userFollowBusiness.setCustomerStatus(ub.getCustomerStatus());
|
|
|
+ userFollowBusiness.setFollowSituation(ub.getFollowSituation());
|
|
|
+ userFollowBusiness.setId(ufbId);
|
|
|
+ userFollowBusiness.setFollowId(followId);
|
|
|
+ userFollowBusiness.setRemarks(ub.getRemarks());
|
|
|
+ userFollowBusiness.setBusinessProjectId(ub.getBusinessProjectId());
|
|
|
+ userFollowBusinessMapper.insert(userFollowBusiness);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|