| | |
| | | |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.data.BaseResp; |
| | | import com.fzzy.igds.data.PledgeReminders; |
| | | import com.fzzy.igds.domain.InoutNoticeIn; |
| | | import com.fzzy.igds.domain.InoutNoticeOut; |
| | | import com.fzzy.igds.domain.PledgeContract; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.DecimalFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Desc: 工单业务接口 |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class BizWorkService { |
| | | |
| | | @Resource |
| | | private WorkOrderConfService confService; |
| | | @Resource |
| | |
| | | |
| | | /** |
| | | * 获取流程配置信息 |
| | | * |
| | | * @param deptId 库区ID |
| | | * @param type 业务类型 |
| | | * @return 配置信息 |
| | |
| | | /** |
| | | * |
| | | * 根据出入库通知单启动审批工单 |
| | | * |
| | | * @param data 出入库工单数据 |
| | | * @return 响应结果 |
| | | */ |
| | |
| | | /** |
| | | * |
| | | * 根据出出库通知单启动审批工单 |
| | | * |
| | | * @param data 出入库工单数据 |
| | | * @return 响应结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据当前节点获取下一个节点 |
| | | * |
| | | * @param curNode |
| | | * @param conf |
| | | * @return |
| | |
| | | /** |
| | | * |
| | | * 根据出入库通知单启动审批工单 |
| | | * |
| | | * @param data 出入库工单数据 |
| | | * @return 响应结果 |
| | | */ |
| | | public BaseResp startByBackMoney(PledgeContract data, WorkOrderConf conf) { |
| | | public BaseResp startByBackMoney(PledgeContract data, WorkOrderConf conf, List<PledgeReminders> remindersList) { |
| | | |
| | | if (null == conf) conf = confService.getByDeptId(data.getPledgeDept(), WorkBizType.TYPE_10); |
| | | |
| | | if (Constant.YN_N.equals(conf.getValTag())) return BaseResp.error("流程未启用"); |
| | | |
| | | //创建工单 |
| | | StringBuilder description = new StringBuilder("当前合同<" + data.getName() + ">下"); |
| | | if (!remindersList.isEmpty()) { |
| | | Double sumMoneyNum = 0.0; |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | |
| | | for (PledgeReminders reminders : remindersList) { |
| | | description.append(",仓库<").append(reminders.getDepotName()).append(">,质押物<").append(reminders.getFoodVarietyName()).append(">库存量为").append(df.format(reminders.getStorageReal())).append("kg,单价").append(reminders.getFoodPrice()).append("元,"); |
| | | sumMoneyNum += reminders.getStorageReal() * reminders.getFoodPrice(); |
| | | } |
| | | description.append("库存量总金额为").append(df.format(sumMoneyNum)).append("元,达到合同待还款金额的110%,请提醒企业进款还款"); |
| | | } else { |
| | | description.append("质押仓库<").append(data.getDepotNames()).append(">库存量金额高于待还款金额,需要进行还款"); |
| | | } |
| | | WorkOrder work = new WorkOrder(); |
| | | work.setId(ContextUtil.generateOrderId("WARN")); |
| | | work.setBizType(WorkBizType.TYPE_50.getCode()); |
| | |
| | | work.setConfId(conf.getId()); |
| | | work.setStatus(WorkStatus.STATUS_30.getCode()); |
| | | work.setReceiveTime(new Date()); |
| | | |
| | | work.setDescription("当前合同<" + data.getName() + ">下质押仓库<" + data.getDepotNames() + ">库存量金额高于待还款金额,需要进行还款!"); |
| | | |
| | | work.setDescription(description.toString()); |
| | | work.setCreateBy("系统生成"); |
| | | work.setCreateById("sys"); |
| | | work.setUpdateBy("系统生成"); |
| | |
| | | |
| | | /** |
| | | * 获取待处理工单 |
| | | * |
| | | * @return 处理结果 |
| | | */ |
| | | public BaseResp todoByProcess(WorkOrderProcess process) { |
| | |
| | | return BaseResp.error("当前工单已处理,请刷新页面重试!!"); |
| | | } |
| | | |
| | | |
| | | //判断是不是指定处理人 |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | if (StringUtils.isNotEmpty(work.getAssigneeId())) { |
| | |
| | | //获取配置信息 |
| | | WorkOrderConf conf = confService.selectById(work.getConfId()); |
| | | if (null == conf) return BaseResp.error("当前工单未配置流程"); |
| | | |
| | | |
| | | //添加记录 |
| | | process.setId(ContextUtil.UUID()); |
| | |
| | | |
| | | // work.setAssigneeName(process.getAssigneeName()); |
| | | // work.setAssigneeId(process.getAssigneeId()); |
| | | |
| | | |
| | | orderService.complete(work); |
| | | |