Commit 1700d0cd by 墨竹

feat:收费

parent d3311953
......@@ -10,6 +10,7 @@ import com.gic.haoban.manage.api.enums.SyncTaskTypeEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.task.manage.api.service.GroupSendOperateApiService;
......@@ -58,6 +59,9 @@ public class TestController extends WebBaseController {
@Autowired
private GroupSendOperateApiService groupSendOperateApiService;
@Autowired
private HaobanQywxFeeApiService haobanQywxFeeApiService;
/**
* 创建定时器
*
......@@ -215,7 +219,7 @@ public class TestController extends WebBaseController {
* @return
*/
@RequestMapping("/flash-friend-wxEnterpriseId")
public HaobanResponse sendMass(String wxEnterpriseId) {
public HaobanResponse sendStockMemberRelationMessage(String wxEnterpriseId) {
if (org.apache.commons.lang.StringUtils.isEmpty(wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
......@@ -223,4 +227,16 @@ public class TestController extends WebBaseController {
groupSendOperateApiService.sendStockMemberRelationMessage(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 收费
*
* @param wxEnterpriseId
* @return
*/
@RequestMapping("/addFee")
public HaobanResponse addFee(String wxEnterpriseId) {
haobanQywxFeeApiService.addFee(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
......@@ -129,10 +129,6 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
}
}
if (CollectionUtils.isEmpty(orderIds)) {
logger.error("订单为空");
return;
}
List<Map<String, String>> activeCodeList = new ArrayList<>();
for (String orderId : orderIds) {
FeeOrderDeatilResponseDTO order = qywxUserApiService.getOrder(corpid, serviceCorpid, orderId);
......@@ -196,7 +192,11 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
activeCodeList.add(map);
}
}
addOrderAccount(wxEnterpriseId, serviceCorpid, corpid, activeCodeList);
if (CollectionUtils.isNotEmpty(activeCodeList)) {
//处理订单账号
addOrderAccount(wxEnterpriseId, serviceCorpid, corpid, activeCodeList);
}
List<String> userIdList = new ArrayList<>();
//企业账号
......@@ -227,10 +227,14 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
userIdList.add(accountListDTO.getUserid());
}
}
addAccountStaff(wxEnterpriseId, serviceCorpid, corpid, userIdList);
//更新企微状态
wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId);
if (CollectionUtils.isNotEmpty(userIdList)) {
addAccountStaff(wxEnterpriseId, serviceCorpid, corpid, userIdList);
}
Integer autoActiveFlag = wxEnterpriseDTO.getAutoActiveFlag();
if (autoActiveFlag != null && autoActiveFlag != 1) {
//更新企微状态
wxEnterpriseService.updateAutoActiveFlagById(1, wxEnterpriseId);
}
//更新收费
HaobanQywxFeeDetailDTO haobanQywxFeeDetailDTO = haobanQywxFeeAccountStaffService.feeIntercept(wxEnterpriseId);
......@@ -286,18 +290,20 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
continue;
}
String userid = activeInfoCodeResponseDTO.getUserid();
TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount = new TabHaobanQywxFeeOrderAccount();
tabHaobanQywxFeeOrderAccount.setFeeAccountId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFeeOrderAccount.setOrderId(orderId);
tabHaobanQywxFeeOrderAccount.setCorpId(corpid);
tabHaobanQywxFeeOrderAccount.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFeeOrderAccount.setWxUserId(userid);
tabHaobanQywxFeeOrderAccount.setActiveCode(activeInfoCodeResponseDTO.getActiveCode());
tabHaobanQywxFeeOrderAccount.setAccountType(activeInfoCodeResponseDTO.getType());
tabHaobanQywxFeeOrderAccount.setStatus(activeInfoCodeResponseDTO.getStatus());
tabHaobanQywxFeeOrderAccount.setExpireTime(DateUtil.date(activeInfoCodeResponseDTO.getExpireTime() * 1000));
tabHaobanQywxFeeOrderAccount.setActiveTime(DateUtil.date(activeInfoCodeResponseDTO.getActiveTime() * 1000));
haobanQywxFeeOrderAccountService.insert(tabHaobanQywxFeeOrderAccount);
if (StringUtils.isNotBlank(userid)) {
TabHaobanQywxFeeOrderAccount tabHaobanQywxFeeOrderAccount = new TabHaobanQywxFeeOrderAccount();
tabHaobanQywxFeeOrderAccount.setFeeAccountId(UniqueIdUtils.uniqueLong());
tabHaobanQywxFeeOrderAccount.setOrderId(orderId);
tabHaobanQywxFeeOrderAccount.setCorpId(corpid);
tabHaobanQywxFeeOrderAccount.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFeeOrderAccount.setWxUserId(userid);
tabHaobanQywxFeeOrderAccount.setActiveCode(activeInfoCodeResponseDTO.getActiveCode());
tabHaobanQywxFeeOrderAccount.setAccountType(activeInfoCodeResponseDTO.getType());
tabHaobanQywxFeeOrderAccount.setStatus(activeInfoCodeResponseDTO.getStatus());
tabHaobanQywxFeeOrderAccount.setExpireTime(DateUtil.date(activeInfoCodeResponseDTO.getExpireTime() * 1000));
tabHaobanQywxFeeOrderAccount.setActiveTime(DateUtil.date(activeInfoCodeResponseDTO.getActiveTime() * 1000));
haobanQywxFeeOrderAccountService.insert(tabHaobanQywxFeeOrderAccount);
}
}
}
......
......@@ -520,7 +520,7 @@
<update id="updateActiveStatusById" >
update tab_haoban_staff
set active_status = #{activeStatus}
set active_status = #{activeStatus},
update_time = now()
where staff_id = #{staffId}
</update>
......
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