|
@@ -12,6 +12,7 @@ import com.rongwei.bscommon.sys.utils.ApsUtils;
|
|
|
import com.rongwei.bsentity.domain.*;
|
|
|
import com.rongwei.bsentity.vo.*;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
+import com.rongwei.rwcommon.base.BaseDo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommon.vo.MailDo;
|
|
@@ -24,12 +25,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.rongwei.safecommon.utils.SaveConstans.DatePattern.DATE_PATTERN_YMD;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
|
|
|
import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.*;
|
|
@@ -431,6 +430,62 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ 报工不合格提醒
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void reportUnqualify() {
|
|
|
+ log.info("报工不合格提醒开始");
|
|
|
+ List<ApsProductionOrderDo> apsProductionOrderDos = this.baseMapper.getReportUnqualify();
|
|
|
+ if (apsProductionOrderDos.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //所有的坯料计划id
|
|
|
+ List<String> blankIds = apsProductionOrderDos.stream().map(ApsProductionOrderDo::getAuditorid).distinct().collect(Collectors.toList());
|
|
|
+ //坯料输出成品
|
|
|
+ List<ApsProcessOutputProductDo> apsProcessOutputProductDos = apsProcessOutputProductService.list(new LambdaQueryWrapper<ApsProcessOutputProductDo>()
|
|
|
+ .in(ApsProcessOutputProductDo::getBlankid, blankIds)
|
|
|
+ .eq(BaseDo::getDeleted, "0")
|
|
|
+ .orderByDesc(ApsProcessOutputProductDo::getModifydate));
|
|
|
+
|
|
|
+ //按照订单分组
|
|
|
+ Map<String, List<ApsProductionOrderDo>> orderList = apsProductionOrderDos.stream().collect(Collectors.groupingBy(e -> e.getId()));
|
|
|
+ final String[] content = {""};
|
|
|
+ orderList.forEach((k, olist) -> {
|
|
|
+ //系统通知(移动端和PC端个人工作台)
|
|
|
+ CXCommonUtils.sendNotify(REPORTUNQUALIFY_TITLE, REPORTUNQUALIFY_CONTENT, null, Arrays.asList(olist.get(0).getCreateuserid().split(",")), k, REPORTUNQUALIFY_REMIND, false);
|
|
|
+
|
|
|
+ //邮件内容
|
|
|
+ content[0] = "<div>报工检验不合格,请及时调整计划</div>" +
|
|
|
+ "<div>客户【" + olist.get(0).getCustomname() + "】【" + DateUtil.format(olist.get(0).getOrderdate(), DATE_PATTERN_YMD) + "】的订单【" + olist.get(0).getOrderno() + "】</div>";
|
|
|
+ //按照坯料计划分组
|
|
|
+ Map<String, List<ApsProductionOrderDo>> blankList = olist.stream().collect(Collectors.groupingBy(o -> o.getAuditorid()));
|
|
|
+ blankList.forEach((b, blist) -> {
|
|
|
+ List<ApsProcessOutputProductDo> apsProcessOutputProductDoList = apsProcessOutputProductDos.stream().filter(out -> out.getBlankid().equals(b)).collect(Collectors.toList());
|
|
|
+ for (ApsProcessOutputProductDo apsProcessOutputProductDo : apsProcessOutputProductDoList) {
|
|
|
+ content[0] += "<div>产品【" + apsProcessOutputProductDo.getProductname() + "】</div>";
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (ApsProductionOrderDo apsProductionOrderDo : olist) {
|
|
|
+ content[0] += "<div>批次号【" + apsProductionOrderDo.getAuditor() + "】工序【" + apsProductionOrderDo.getCustomorderno() + "】检验等级【" + apsProductionOrderDo.getCustomordertype() + "】</div>";
|
|
|
+ content[0] += "<div>主要缺陷【" + (apsProductionOrderDo.getRemark() == null ? "" : apsProductionOrderDo.getRemark()) + "】</div>";
|
|
|
+ content[0] += "<div>次要缺陷【" + (apsProductionOrderDo.getOtherprecaution() == null ? "" : apsProductionOrderDo.getOtherprecaution()) + "】</div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ //邮件提醒
|
|
|
+ if (StringUtils.isNotEmpty(olist.get(0).getModifyusername())) {
|
|
|
+ MailDo mailDo = new MailDo();
|
|
|
+ mailDo.setReceiveEmail(olist.get(0).getModifyusername().split(","));
|
|
|
+ mailDo.setNeedTransReceive(false);
|
|
|
+ mailDo.setCcEmail(new String[]{});
|
|
|
+ mailDo.setSubject(REPORTUNQUALIFY_TITLE);
|
|
|
+ mailDo.setContent(content[0]);
|
|
|
+ autoCommonFeginClient.sendHtmlMail(mailDo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|