|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.ctop.finance.policy.service.impl;
|
|
|
|
|
|
+import android.widget.RelativeLayout;
|
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
|
+import cn.com.ctop.common.module.mapper.ProductMapper;
|
|
|
import cn.com.ctop.common.module.mapper.SysUserMapper;
|
|
|
import cn.com.ctop.common.module.utils.CorpWexinUtils;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -12,8 +14,10 @@ import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
|
|
|
import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
|
|
|
import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
|
|
|
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
|
|
|
import org.jeecg.ctop.finance.policy.service.ICwjsPolicyInfoService;
|
|
|
import org.jeecg.ctop.finance.policy.utils.Check;
|
|
|
+import org.jeecg.ctop.finance.settlement.mapper.CwjsProfitMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -42,6 +46,13 @@ public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper,
|
|
|
@Resource
|
|
|
private CwjsPolicyApprovalLogServiceImpl policyApprovalLogService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CwjsPolicyProductMapper cwjsPolicyProductMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CwjsProfitMapper cwjsProfitMapper;
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @description: 查看政策列表
|
|
@@ -112,7 +123,7 @@ public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper,
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserMapper userMapper;
|
|
|
|
|
|
@Override
|
|
@@ -225,6 +236,42 @@ public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper,
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 政策作废
|
|
|
+ * @param policyId 政策id
|
|
|
+ * @param delReason 作废原因
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result toVoidpolicy(String policyId,String delReason) {
|
|
|
+ CwjsPolicyInfo cwjsPolicyInfo = policyInfoMapper.selectById(policyId);
|
|
|
+ // 1:待审核 2:审核中 3:审核通过4:审核拒绝
|
|
|
+ if (Check.isNull(cwjsPolicyInfo) || cwjsPolicyInfo.getApprovedStatus() !=3){
|
|
|
+ return Result.errorMsg("政策不存在或政策还在审核,审核中的政策无法作废。");
|
|
|
+ }
|
|
|
+ //修改政策状态及作废原因
|
|
|
+ policyInfoMapper.updatePolicyToVOidById(policyId,delReason);
|
|
|
+ //删除政策关联的产品信息
|
|
|
+ cwjsPolicyProductMapper.deleteProductsByPolicyId(Integer.valueOf(policyId));
|
|
|
+ //删除该政策利润表记录
|
|
|
+ cwjsProfitMapper.delSlettmentReportByPolicyId(policyId);
|
|
|
+
|
|
|
+ JSONObject examineUser = policyInfoMapper.getUserLeaderAndDirectorByRoleName(cwjsPolicyInfo.getCreateUserId(),"分公司总经理");
|
|
|
+ List<String> userList = new ArrayList<>();
|
|
|
+ userList.add(examineUser.getString("leaderId"));
|
|
|
+ userList.add(examineUser.getString("directorId"));
|
|
|
+
|
|
|
+ for (String userId : userList) {
|
|
|
+ //给销售总监发送
|
|
|
+ JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId("80e747cdea6f41dbbc8cde23046fd4e0");
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ text.append(cwjsPolicyInfo.getCreateUserName()+"创建的政策,客户为:"+cwjsPolicyInfo.getCompanyName());
|
|
|
+ text.append(",该销售政策已作废。");
|
|
|
+ corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.successMsg("政策作废成功",null);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|