|
|
@ -12,6 +12,10 @@ import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.supervise.report.api.messageopenid.MessageOpenid; |
|
|
|
import com.yxt.supervise.report.api.messagepushlog.MessagePushLog; |
|
|
|
import com.yxt.supervise.report.biz.messageopenid.MessageOpenidService; |
|
|
|
import com.yxt.supervise.report.biz.messagepushlog.MessagePushLogService; |
|
|
|
import com.yxt.supervise.report.biz.projectdailyaccount.ProjectDailyAccountDto; |
|
|
|
import com.yxt.supervise.report.biz.projectdailyaccount.ProjectDailyAccountService; |
|
|
|
import com.yxt.supervise.report.biz.wechat.WechatRest; |
|
|
@ -19,7 +23,9 @@ import com.yxt.supervise.report.biz.wechat.WechatService; |
|
|
|
import com.yxt.supervise.report.ds.crm.CrmMapper; |
|
|
|
import com.yxt.supervise.report.ds.crm.ProjectInfo; |
|
|
|
import com.yxt.supervise.report.ds.crm.UserProject; |
|
|
|
import com.yxt.supervise.report.ds.system.SysUser; |
|
|
|
import com.yxt.supervise.system.sysuser.ProjectInformationVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
@ -48,6 +54,12 @@ public class ProjectDailyService extends ServiceImpl<ProjectDailyMapper, Project |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ProjectDailyAccountService projectDailyAccountService; |
|
|
|
@Autowired |
|
|
|
private MessagePushLogService messagePushLogService; |
|
|
|
@Autowired |
|
|
|
private com.yxt.supervise.report.ds.system.systemMapper systemMapper; |
|
|
|
@Autowired |
|
|
|
private MessageOpenidService messageOpenidService; |
|
|
|
public PagerVo<ProjectDaily> selectListPage(PagerQuery<ProjectDailyQuery> pq) { |
|
|
|
ProjectDailyQuery params = pq.getParams(); |
|
|
|
QueryWrapper<ProjectDaily> wq = new QueryWrapper<>(); |
|
|
@ -109,15 +121,15 @@ public class ProjectDailyService extends ServiceImpl<ProjectDailyMapper, Project |
|
|
|
if(null!=projectInfo) { |
|
|
|
// System.out.println(projectDaily.getBankPledgeRate()/100);
|
|
|
|
projectDaily.setBankPledgeRate(projectInfo.getBankPledgeRate()); |
|
|
|
if (projectInfo.getBankPledgeRate() / 100 > projectDaily.getPledgeRate()) { |
|
|
|
if (projectInfo.getBankPledgeRate() > Double.valueOf(projectDaily.getPledgeRatePercent())) { |
|
|
|
projectDaily.setState("1"); |
|
|
|
} |
|
|
|
list.add(projectDaily); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("creditLimitTotal",creditLimitTotal); |
|
|
|
map.put("useLimitTotal",useLimitTotal); |
|
|
|
map.put("creditLimitTotal",String.format("%.2f",creditLimitTotal)); |
|
|
|
map.put("useLimitTotal",String.format("%.2f",useLimitTotal)); |
|
|
|
map.put("list",list); |
|
|
|
return map; |
|
|
|
} |
|
|
@ -170,14 +182,62 @@ public class ProjectDailyService extends ServiceImpl<ProjectDailyMapper, Project |
|
|
|
projectDaily.setCreditLimit(projectInfo.getCreditLimit()); |
|
|
|
projectDaily.setUseLimit(projectInfo.getUseLimit()); |
|
|
|
projectDaily.setBankPledgeRate(projectInfo.getBankPledgeRate()); |
|
|
|
if (projectInfo.getBankPledgeRate() / 100 > projectDaily.getPledgeRate()) { |
|
|
|
if (projectInfo.getBankPledgeRate() >Double.valueOf(projectDaily.getPledgeRatePercent())) { |
|
|
|
projectDaily.setState("1"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return projectDaily; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean ww(ProjectDailys ProjectDailys){ |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isNoneBlank(ProjectDailys.getUserSid())) { |
|
|
|
int count = crmMapper.getCountByUserSidAndProjectSid(ProjectDailys.getProjectSid(), ProjectDailys.getUserSid()); |
|
|
|
if (count == 0) { |
|
|
|
return rb.setMsg("无权限").setCode("410"); |
|
|
|
} |
|
|
|
// String openid=systemMapper.getAppletOpenidByUsersid(ProjectDailys.getUserSid());
|
|
|
|
SysUser sysUser = systemMapper.getAppletOpenidByUsersid(ProjectDailys.getUserSid()); |
|
|
|
if (StringUtils.isBlank(sysUser.getAppletOpenid())) { |
|
|
|
return rb.setMsg("请先去绑定").setCode("420"); |
|
|
|
} |
|
|
|
MessagePushLog m = messagePushLogService. |
|
|
|
getOne(new QueryWrapper<MessagePushLog>(). |
|
|
|
eq("projectSid", ProjectDailys.getProjectSid()). |
|
|
|
eq("orderDate", ProjectDailys.getOrderDate())); |
|
|
|
if (null != m) { |
|
|
|
MessageOpenid messageOpenid = messageOpenidService.getOne(new QueryWrapper<MessageOpenid>().eq("openId", sysUser.getAppletOpenid()).eq("messageSid", m.getSid())); |
|
|
|
if (null != messageOpenid) { |
|
|
|
messageOpenid.setState("1"); |
|
|
|
messageOpenidService.updateById(messageOpenid); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (StringUtils.isNoneBlank(ProjectDailys.getWxCode())) { |
|
|
|
ResultBean<JSONObject> rbJsonObject = wxLogin(ProjectDailys.getWxCode(), "", ""); |
|
|
|
JSONObject jsonObject = rbJsonObject.getData(); |
|
|
|
String openid = jsonObject.get("openid").toString(); |
|
|
|
String userSid = systemMapper.getUserSidByOpenid(openid); |
|
|
|
if (StringUtils.isBlank(userSid)) { |
|
|
|
return rb.setMsg("请先去绑定").setCode("420"); |
|
|
|
} |
|
|
|
int count = crmMapper.getCountByUserSidAndProjectSid(ProjectDailys.getProjectSid(), userSid); |
|
|
|
if (count == 0) { |
|
|
|
return rb.setMsg("无权限").setCode("410"); |
|
|
|
} |
|
|
|
MessagePushLog m = messagePushLogService.getOne(new QueryWrapper<MessagePushLog>() |
|
|
|
.eq("projectSid", ProjectDailys.getProjectSid()).eq("orderDate", ProjectDailys.getOrderDate())); |
|
|
|
if (null != m) { |
|
|
|
MessageOpenid messageOpenid = messageOpenidService.getOne(new QueryWrapper<MessageOpenid>().eq("openId", openid).eq("messageSid", m.getSid())); |
|
|
|
if (null != messageOpenid) { |
|
|
|
messageOpenid.setState("1"); |
|
|
|
messageOpenidService.updateById(messageOpenid); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (StringUtils.isBlank(ProjectDailys.getWxCode()) && StringUtils.isBlank(ProjectDailys.getUserSid())) { |
|
|
|
return rb.setMsg("无权限").setCode("410"); |
|
|
|
} |
|
|
|
return rb.success().setCode("200"); |
|
|
|
} |
|
|
|
public void sendMess(String projectSid, String orderDate) { |
|
|
|
ProjectDaily projectDaily = this.fetchByProjectAndDay(projectSid, orderDate); |
|
|
|
projectDaily.setMessState(1); |
|
|
|