Commit cb05b927 authored by wanghang's avatar wanghang

订单采购

parent d9ac5f17
...@@ -28,16 +28,17 @@ public class DefinitionHomepageTaskData extends BaseApplication { ...@@ -28,16 +28,17 @@ public class DefinitionHomepageTaskData extends BaseApplication {
*/ */
@Around("execution(public java.util.Map<String, Object> com.huigou.uasp.bpm.engine.application.impl.WorkflowApplicationImpl.queryTrackingTasks())") @Around("execution(public java.util.Map<String, Object> com.huigou.uasp.bpm.engine.application.impl.WorkflowApplicationImpl.queryTrackingTasks())")
public Map<String, Object> replaceQueryTrackingTasks(){ public Map<String, Object> replaceQueryTrackingTasks(){
// 当前登录用户是否以任务发起人的身份发起过任务 // 当前登录用户是否以任务发起人的身份发起过任务流程
List<BsnMessageSponsor> messageSponsors = bsnMessageApplication.queryFinishBsnMessageSponsor(); List<BsnMessageSponsor> messageSponsors = bsnMessageApplication.queryFinishBsnMessageSponsor();
// 若有发起过任务且所有的执行人执行完毕,则由系统创建一份审批任务给当前用户
for (BsnMessageSponsor sponsor : messageSponsors) { for (BsnMessageSponsor sponsor : messageSponsors) {
//该流程下是否所有单位已就绪 //该流程下是否所有单位已就绪
BsnMessageExecute systemExecute = bsnMessageApplication.isExecutesReady(sponsor.getId()); BsnMessageExecute systemExecute = bsnMessageApplication.isExecutesReady(sponsor.getId());
//更新其中审批任务的状态 //若就绪更新其中流程、流程下审批任务的状态
if(systemExecute!=null){ if(systemExecute!=null){
systemExecute.setActive(ActiveStatus.UNFINISHED.getValue()); systemExecute.setActive(ActiveStatus.UNFINISHED.getValue());
bsnMessageApplication.saveBsnMessageExecute(systemExecute); sponsor.setStatus(1);
sponsor.addExecute(systemExecute);
bsnMessageApplication.saveBsnMessageSponsor(sponsor);
} }
} }
//获取任务执行人为当前用户的任务 //获取任务执行人为当前用户的任务
......
...@@ -30,15 +30,25 @@ public interface BsnMessageApplication { ...@@ -30,15 +30,25 @@ public interface BsnMessageApplication {
*/ */
void keepAndPublishTasks(BsnMessageSponsor bsnMessageSponsor); void keepAndPublishTasks(BsnMessageSponsor bsnMessageSponsor);
// /** /**
// * 驳回任务 * 发布人驳回任务
// */ * @param exMap put("驳回部门","驳回信息")
// void rejectTasks(); * @param bid 表单id
*/
void rejectTasks(Map<String ,Object> exMap,String bid);
/**
* 发布人批准任务
*/
void authorizeTasks(String bId);
/** /**
* 批准 * 执行人提交任务
* @param mId
*/ */
// void authorizeTasks(); void submitTask(String mId);
/** /**
* 任务流转 * 任务流转
...@@ -47,7 +57,6 @@ public interface BsnMessageApplication { ...@@ -47,7 +57,6 @@ public interface BsnMessageApplication {
/** /**
* 获取当前登录用户未完成或被驳回的任务 * 获取当前登录用户未完成或被驳回的任务
* @return 任务执行的详细信息集合 * @return 任务执行的详细信息集合
...@@ -62,51 +71,21 @@ public interface BsnMessageApplication { ...@@ -62,51 +71,21 @@ public interface BsnMessageApplication {
List<BsnMessageSponsor> queryFinishBsnMessageSponsor(); List<BsnMessageSponsor> queryFinishBsnMessageSponsor();
/** /**
* 根据任务发布Id,获取该流程下是否所有执行单位已就绪 * 根据任务发布Id,获取该流程下是否所有执行单位已就绪。若就绪返回审批任务
* @param msId * @param msId
* @return * @return
*/ */
BsnMessageExecute isExecutesReady(String msId); BsnMessageExecute isExecutesReady(String msId);
public void saveBsnMessageSponsor(List<BsnMessageSponsor> all); String saveBsnMessageSponsor(BsnMessageSponsor entity);
public String saveBsnMessageSponsor(BsnMessageSponsor entity);
public void saveBsnMessageExecute(List<BsnMessageExecute> all);
public String saveBsnMessageExecute(BsnMessageExecute entity);
public void saveBsnMessageReject(List<BsnMessageReject> all);
public void saveBsnMessageReject(BsnMessageReject entity);
public void deleteBsnMessageSponsor(BsnMessageSponsor entity);
/**
* 根据任务发布id获取旗下任务执行信息
* @param msId
* @return
*/
List<BsnMessageExecute> getExecuteByMsId(String msId);
BsnMessageExecute getExecuteByMeId(String id);
/** /**
* 根据任务执行id获取驳回信息 * 根据任务执行id获取驳回信息
* @param meId * @param meId
* @return * @return
*/ */
List<BsnMessageReject> getRejectByMeId(String meId); List<BsnMessageReject> getRejectDetail(String meId);
/**
* 根据表单号获取任务发布信息及其下的执行单位信息
* @param bid
* @return
*/
BsnMessageSponsor getSponsorByBId(String bid);
/**
* 获取同一份任务流程的其他执行部门,且排除自己
* @param meId
* @return
*/
List<BsnMessageExecute> getBrotherExecuteByMeId(String meId);
} }
...@@ -58,40 +58,72 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -58,40 +58,72 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
if(sponsor==null){ if(sponsor==null){
throw new RuntimeException("不存在该业务"); throw new RuntimeException("不存在该业务");
} }
List<BsnMessageExecute> executes = this.getExecuteByMsId(sponsor.getId()); List<BsnMessageExecute> executes = this.getExecutesByMsId(sponsor.getId());
this.updateActiveStatus(executes); this.updateActiveStatus(executes,ActiveStatus.UNFINISHED.getValue());
this.saveBsnMessageExecute(executes); this.saveBsnMessageExecute(executes);
} }
@Override @Override
public void keepAndPublishTasks(BsnMessageSponsor bsnMessageSponsor) { public void keepAndPublishTasks(BsnMessageSponsor bsnMessageSponsor) {
this.updateActiveStatus(bsnMessageSponsor.getExecutes()); this.updateActiveStatus(bsnMessageSponsor.getExecutes(),ActiveStatus.UNFINISHED.getValue());
this.keepTasks(bsnMessageSponsor); this.keepTasks(bsnMessageSponsor);
} }
// @Override @Override
// public void authorizeTasks(String bId) { public void authorizeTasks(String bId) {
// BsnMessageSponsor sponsor = messageSponsorRepository.findByBusinessId(bId); BsnMessageSponsor sponsor = this.getSponsorByBId(bId);
// } sponsor.setStatus(2);
this.updateActiveStatus(sponsor.getExecutes(),ActiveStatus.FINISHED.getValue());
this.saveBsnMessageSponsor(sponsor);
}
@Override
public void rejectTasks(Map<String ,Object> exMap,String bId) {
BsnMessageSponsor sponsor = this.getSponsorByBId(bId);
if(sponsor!=null){
List<BsnMessageExecute> brotherExecuteAll = sponsor.getExecutes();
Map<String, BsnMessageExecute> executeMap = new HashMap<>();
Date date = new Date();
for (BsnMessageExecute execute : brotherExecuteAll) {
executeMap.put(execute.getTaskExecute(), execute);
}
for (String key : exMap.keySet()) {
BsnMessageExecute execute = executeMap.get(key);
if (execute != null) {
//更改驳回状态
execute.setActive(ActiveStatus.REJECTED.getValue());
//更新时间
execute.setUpdateDate(date);
//封装驳回详情
BsnMessageReject reject = new BsnMessageReject();
reject.setRejectMsg((String) exMap.get(key));
reject.setRejectDate(date);
reject.setBsnExecuteId(execute.getId());
execute.addReject(reject);
this.saveBsnMessageExecute(execute);
}
}
//当前审核任务回退
BsnMessageExecute systemExecute = this.getSystemExecuteByMsId(sponsor.getId());
systemExecute.setActive(ActiveStatus.SAVED.getValue());
this.saveBsnMessageExecute(systemExecute);
//流程退回等待
sponsor.setStatus(0);
this.saveBsnMessageSponsor(sponsor);
}
// @Override }
// public void rejectTasks(BsnMessageExecute execute) {
// //更改驳回状态
// execute.setActive(ActiveStatus.REJECTED.getValue());
// //更新时间
// execute.setUpdateDate(new Date());
// //封装驳回详细
// BsnMessageReject reject = new BsnMessageReject();
// reject.setRejectMsg(sdo.getString(key));
// reject.setRejectDate(new Date());
// reject.setBsnExecuteId(execute.getId());
// execute.addReject(reject);
// this.saveBsnMessageExecute(execute);
// }
@Override @Override
public void submitTask(String mId) {
BsnMessageExecute execute = this.getExecuteByMeId(mId);
execute.setActive(ActiveStatus.FINISHED.getValue());
this.saveBsnMessageExecute(execute);
}
// @Override
public Map<String, Object> circulate(String meId) { public Map<String, Object> circulate(String meId) {
BsnMessageExecute execute = this.getExecuteByMeId(meId); BsnMessageExecute execute = this.getExecuteByMeId(meId);
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
...@@ -99,12 +131,13 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -99,12 +131,13 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
paramMap.put("active",execute.getActive()); paramMap.put("active",execute.getActive());
paramMap.put("meId",execute.getId()); paramMap.put("meId",execute.getId());
paramMap.put("isReadOnly","false"); paramMap.put("isReadOnly","false");
if("system".equals(execute.getBusinessCode())){
//获取该业务流程下其他执行部门 //获取该业务流程下其他执行部门
List<BsnMessageExecute> executeAll = this.getBrotherExecuteByMeId(meId); List<BsnMessageExecute> executeAll = this.getExecutesByMsId(execute.getMessageSponsorId());
Map<String, String> map = executeAll.stream() Map<String, String> map = executeAll.stream()
.collect(Collectors.toMap(BsnMessageExecute::getTaskExecute, BsnMessageExecute::getBusinessCode)); .collect(Collectors.toMap(BsnMessageExecute::getTaskExecute, BsnMessageExecute::getBusinessCode));
paramMap.put("auditDeptMap", map); paramMap.put("auditDeptMap", map);
}
return paramMap; return paramMap;
} }
...@@ -135,9 +168,6 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -135,9 +168,6 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
return this.sqlExecutorDao.queryToObject(queryDescriptor.getSql(),BsnMessageExecute.class,msId,msId); return this.sqlExecutorDao.queryToObject(queryDescriptor.getSql(),BsnMessageExecute.class,msId,msId);
} }
public void saveBsnMessageSponsor(List<BsnMessageSponsor> all){
messageSponsorRepository.save(all);
}
public String saveBsnMessageSponsor(BsnMessageSponsor entity){ public String saveBsnMessageSponsor(BsnMessageSponsor entity){
String keyId = messageSponsorRepository.save(entity).getId(); String keyId = messageSponsorRepository.save(entity).getId();
...@@ -160,14 +190,8 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -160,14 +190,8 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
} }
return keyId; return keyId;
} }
public void saveBsnMessageReject(List<BsnMessageReject> all){
messageRejectRepository.save(all);
}
public void saveBsnMessageReject(BsnMessageReject entity){
messageRejectRepository.save(entity);
}
@Override
public void deleteBsnMessageSponsor(BsnMessageSponsor entity) { public void deleteBsnMessageSponsor(BsnMessageSponsor entity) {
if(isNotEmpty(entity.getExecutes())){ if(isNotEmpty(entity.getExecutes())){
messageExecuteRepository.delete(entity.getExecutes()); messageExecuteRepository.delete(entity.getExecutes());
...@@ -175,35 +199,44 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -175,35 +199,44 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
messageSponsorRepository.delete(entity); messageSponsorRepository.delete(entity);
} }
@Override
public List<BsnMessageExecute> getExecuteByMsId(String msId) { /**
return messageExecuteRepository.findAllByMessageSponsorId(msId); * 获取流程下的执行人,不含审批任务
* @param msId
* @return
*/
public List<BsnMessageExecute> getExecutesByMsId(String msId) {
List<BsnMessageExecute> exList= messageExecuteRepository.findAllByMessageSponsorId(msId);
for (BsnMessageExecute execute : exList) {
if("system".equals(execute.getBusinessCode())){
exList.remove(execute);
}
}
return exList;
} }
@Override
public BsnMessageExecute getExecuteByMeId(String id) { public BsnMessageExecute getExecuteByMeId(String id) {
return messageExecuteRepository.findOne(id); return messageExecuteRepository.findOne(id);
} }
//获取审批任务
public BsnMessageExecute getSystemExecuteByMsId(String msId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "querySystemExecute");
return this.sqlExecutorDao.queryToObject(queryDescriptor.getSql(), BsnMessageExecute.class, msId);
}
@Override @Override
public List<BsnMessageReject> getRejectByMeId(String meId) { public List<BsnMessageReject> getRejectDetail(String meId) {
Sort sort = new Sort(Sort.Direction.DESC, "rejectDate"); Sort sort = new Sort(Sort.Direction.DESC, "rejectDate");
return messageRejectRepository.findAllByBsnExecuteId(meId,sort); return messageRejectRepository.findAllByBsnExecuteId(meId,sort);
} }
@Override
public List<BsnMessageExecute> getBrotherExecuteByMeId(String meId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "queryBrotherExecute");
Map<String,Object> mapParam = new HashMap<>();
mapParam.put("meId",meId);
return this.sqlExecutorDao.queryToListByMapParam(queryDescriptor.getSql(), BsnMessageExecute.class, mapParam);
}
@Override
public BsnMessageSponsor getSponsorByBId(String bId) { public BsnMessageSponsor getSponsorByBId(String bId) {
BsnMessageSponsor sponsor = messageSponsorRepository.findByBusinessId(bId); BsnMessageSponsor sponsor = messageSponsorRepository.findByBusinessId(bId);
if(sponsor!=null){ if(sponsor!=null){
List<BsnMessageExecute> executeList =this.getExecuteByMsId(sponsor.getId()); List<BsnMessageExecute> executeList =this.getExecutesByMsId(sponsor.getId());
sponsor.setExecutes(executeList); sponsor.setExecutes(executeList);
} }
return sponsor; return sponsor;
...@@ -214,11 +247,11 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes ...@@ -214,11 +247,11 @@ public class BsnMessageApplicationImpl extends BaseApplication implements BsnMes
} }
public void updateActiveStatus( List<BsnMessageExecute> executes) { public void updateActiveStatus( List<BsnMessageExecute> executes,Integer status) {
//将除审批任务外状态为保存未分发的全部修改为分发未完成 //将除审批任务外状态为保存未分发的全部修改
for (BsnMessageExecute execute : executes) { for (BsnMessageExecute execute : executes) {
if(!"system".equals(execute.getBusinessCode())){ if(!"system".equals(execute.getBusinessCode())){
execute.setActive(ActiveStatus.UNFINISHED.getValue()); execute.setActive(status);
} }
} }
} }
......
...@@ -5,10 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -5,10 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.topsun.base.bsnMessage.appliction.BsnMessageApplication; import com.huigou.topsun.base.bsnMessage.appliction.BsnMessageApplication;
import com.huigou.topsun.base.bsnMessage.domain.ActiveStatus; import com.huigou.topsun.base.bsnMessage.domain.*;
import com.huigou.topsun.base.bsnMessage.domain.BsnMessageExecute;
import com.huigou.topsun.base.bsnMessage.domain.BsnMessageReject;
import com.huigou.topsun.base.bsnMessage.domain.BsnMessageSponsor;
import com.huigou.topsun.sap.nonProdApply.application.NonProdApplyDeptApplication; import com.huigou.topsun.sap.nonProdApply.application.NonProdApplyDeptApplication;
import com.huigou.topsun.sap.nonProdApply.domain.SapNonProdApplyDept; import com.huigou.topsun.sap.nonProdApply.domain.SapNonProdApplyDept;
...@@ -52,8 +49,8 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements ...@@ -52,8 +49,8 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements
bsnMessageSponsor.setTaskSponsor(this.getOperator().getUserId()); bsnMessageSponsor.setTaskSponsor(this.getOperator().getUserId());
bsnMessageSponsor.setTitle("非产品/非本成品类物料"); bsnMessageSponsor.setTitle("非产品/非本成品类物料");
bsnMessageSponsor.setExecutorUrl("sapNonProdApplyNext/fillInNonProdApplyDept.do"); bsnMessageSponsor.setExecutorUrl("sapNonProdApplyNext/fillInNonProdApplyDept.do");
bsnMessageSponsor.setCreateDate(new Date());
bsnMessageSponsor.setBusinessId(nonProdApplyDept.getApplyDeptId()); bsnMessageSponsor.setBusinessId(nonProdApplyDept.getApplyDeptId());
bsnMessageSponsor.setCreateDate(new Date());
bsnMessageSponsor.setStatus(0); bsnMessageSponsor.setStatus(0);
for (Map<String, String> stringMap : deptStaffList) { for (Map<String, String> stringMap : deptStaffList) {
...@@ -95,33 +92,38 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements ...@@ -95,33 +92,38 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements
@Override @Override
public void rejectNonProdApplyDept(SDO sdo) { public void rejectNonProdApplyDept(SDO sdo) {
String meId = sdo.getString("meId"); String meId = sdo.getString("meId");
//需要被驳回的部门
List<BsnMessageExecute> brotherExecuteAll = bsnMessageApplication.getBrotherExecuteByMeId(meId);
Map<String, BsnMessageExecute> executeMap = new HashMap<>(); // //需要被驳回的部门
for (BsnMessageExecute execute : brotherExecuteAll) { // List<BsnMessageExecute> brotherExecuteAll = bsnMessageApplication.getBrotherExecuteByMeId(meId);
executeMap.put(execute.getTaskExecute(), execute); // Map<String, BsnMessageExecute> executeMap = new HashMap<>();
} // for (BsnMessageExecute execute : brotherExecuteAll) {
// 遍历 SDO 对象中的 key // executeMap.put(execute.getTaskExecute(), execute);
for (String key : sdo.getProperties().keySet()) { // }
// 如果存在对应的 BsnMessageExecute,进行操作
BsnMessageExecute execute = executeMap.get(key);
if (execute != null) {
//更改驳回状态 // // 遍历 SDO 对象中的 key
execute.setActive(ActiveStatus.REJECTED.getValue()); // for (String key : sdo.getProperties().keySet()) {
//更新时间 // // 如果存在对应的 BsnMessageExecute,进行操作
execute.setUpdateDate(new Date()); // BsnMessageExecute execute = executeMap.get(key);
//封装驳回详细 // if (execute != null) {
BsnMessageReject reject = new BsnMessageReject(); // //更改驳回状态
reject.setRejectMsg(sdo.getString(key)); // execute.setActive(ActiveStatus.REJECTED.getValue());
reject.setRejectDate(new Date()); // //更新时间
reject.setBsnExecuteId(execute.getId()); // execute.setUpdateDate(new Date());
execute.addReject(reject); // //封装驳回详细
bsnMessageApplication.saveBsnMessageExecute(execute); // BsnMessageReject reject = new BsnMessageReject();
} // reject.setRejectMsg(sdo.getString(key));
} // reject.setRejectDate(new Date());
//当前审核任务回退 // reject.setBsnExecuteId(execute.getId());
BsnMessageExecute systemExecute = bsnMessageApplication.getExecuteByMeId(meId); // execute.addReject(reject);
systemExecute.setActive(ActiveStatus.SAVED.getValue()); // bsnMessageApplication.saveBsnMessageExecute(execute);
bsnMessageApplication.saveBsnMessageExecute(systemExecute); // }
// }
// //当前审核任务回退
// BsnMessageExecute systemExecute = bsnMessageApplication.getExecuteByMeId(meId);
// systemExecute.setActive(ActiveStatus.SAVED.getValue());
// bsnMessageApplication.saveBsnMessageExecute(systemExecute);
} }
} }
...@@ -102,7 +102,7 @@ public class NonProdApplyNextController extends CommonController { ...@@ -102,7 +102,7 @@ public class NonProdApplyNextController extends CommonController {
public String slicedRejectCauseList(){ public String slicedRejectCauseList(){
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
String meId = sdo.getString("meId"); String meId = sdo.getString("meId");
List<BsnMessageReject> rejectAll = bsnMessageApplication.getRejectByMeId(meId); List<BsnMessageReject> rejectAll = bsnMessageApplication.getRejectDetail(meId);
return toResult(rejectAll); return toResult(rejectAll);
} }
......
...@@ -22,5 +22,6 @@ public interface SapPurchaseOrderApplication { ...@@ -22,5 +22,6 @@ public interface SapPurchaseOrderApplication {
void saveSapPurchaseOrderVo(SapPurchaseOrderVo sapPurchaseOrderVo); void saveSapPurchaseOrderVo(SapPurchaseOrderVo sapPurchaseOrderVo);
void sendSapDate(SapPurchaseOrder sapPurchaseOrder,String flag); void sendSapDate(SapPurchaseOrder sapPurchaseOrder,String flag);
} }
...@@ -15,7 +15,7 @@ public interface SapPurchaseOrderItemApplication { ...@@ -15,7 +15,7 @@ public interface SapPurchaseOrderItemApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/sapPurchaseOrder/sapPurchaseOrderItem.xml"; public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/sapPurchaseOrder/sapPurchaseOrderItem.xml";
void saveSapPurchaseOrderItem(SapPurchaseOrderItem sapPurchaseOrderItem); void saveSapPurchaseOrderItem(SapPurchaseOrderItem sapPurchaseOrderItem);
void deleteByIds(List<String> ids); void deleteById(String id);
SapPurchaseOrderItem getPurchaseOrderItem(String purchaseOrderId); SapPurchaseOrderItem getPurchaseOrderItem(String purchaseOrderId);
......
...@@ -88,7 +88,7 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -88,7 +88,7 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
@Override @Override
protected Map<String, Object> getProcessBizParams(String bizId) { protected Map<String, Object> getProcessBizParams(String bizId) {
// 返回业务数据给流程实例 // 返回业务数据给流程实例
return ClassHelper.toMap(sapPurchaseOrderRepository.getOne(bizId)); return ClassHelper.toMap(sapPurchaseOrderRepository.getOne(bizId));
} }
...@@ -126,6 +126,9 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -126,6 +126,9 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
sapPurchaseOrder.setStatusId(BizBillStatus.APPLYING.getId()); sapPurchaseOrder.setStatusId(BizBillStatus.APPLYING.getId());
SapPurchaseOrder save = sapPurchaseOrderRepository.save(sapPurchaseOrder); SapPurchaseOrder save = sapPurchaseOrderRepository.save(sapPurchaseOrder);
this.sendSapDate(save,"X"); this.sendSapDate(save,"X");
// 调用 onEnd 方法
// DelegateExecution execution = delegateTask.getExecution();
// onEnd(execution);
} }
} }
...@@ -145,8 +148,12 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -145,8 +148,12 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
@Override @Override
@Transactional @Transactional
public void saveSapPurchaseOrderVo(SapPurchaseOrderVo sapPurchaseOrderVo) { public void saveSapPurchaseOrderVo(SapPurchaseOrderVo sapPurchaseOrderVo) {
SapPurchaseOrder purchaseOrder = sapPurchaseOrderRepository.findAllByEbeln(sapPurchaseOrderVo.getEbeln());
String purchaseOrderId="";
//数据第一次接收,创建流程任务
if(purchaseOrder==null) {
SapPurchaseOrder sapPurchaseOrder = new SapPurchaseOrder(); SapPurchaseOrder sapPurchaseOrder = new SapPurchaseOrder();
BeanUtil.copyProperties(sapPurchaseOrderVo,sapPurchaseOrder); BeanUtil.copyProperties(sapPurchaseOrderVo, sapPurchaseOrder);
//初始化用户信息 //初始化用户信息
String createdById = "5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0"; String createdById = "5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0";
Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById); Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById);
...@@ -157,15 +164,25 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -157,15 +164,25 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
sapPurchaseOrder.setId(bizId); sapPurchaseOrder.setId(bizId);
sapPurchaseOrder = this.sapPurchaseOrderRepository.save(sapPurchaseOrder); sapPurchaseOrder = this.sapPurchaseOrderRepository.save(sapPurchaseOrder);
SapPurchaseOrderItemVo OrderItemVo = sapPurchaseOrderVo.getItemVo(); purchaseOrderId=sapPurchaseOrder.getId();
}else {
//数据第n次接收覆盖上一次数据
purchaseOrder.setBatxt(sapPurchaseOrderVo.getBatxt());
purchaseOrder.setBsart(sapPurchaseOrderVo.getBsart());
this.sapPurchaseOrderRepository.save(purchaseOrder);
SapPurchaseOrderItem purchaseOrderItem = sapPurchaseOrderItemApplication.getPurchaseOrderItem(purchaseOrder.getId());
sapPurchaseOrderItemApplication.deleteById(purchaseOrderItem.getId());
purchaseOrderId=purchaseOrder.getId();
}
SapPurchaseOrderItem sapPurchaseOrderItem = new SapPurchaseOrderItem(); SapPurchaseOrderItem sapPurchaseOrderItem = new SapPurchaseOrderItem();
BeanUtil.copyProperties(OrderItemVo,sapPurchaseOrderItem); BeanUtil.copyProperties(sapPurchaseOrderVo.getItem(), sapPurchaseOrderItem);
sapPurchaseOrderItem.setPurchaseOrderId(sapPurchaseOrder.getId()); sapPurchaseOrderItem.setPurchaseOrderId(purchaseOrderId);
sapPurchaseOrderItemApplication.saveSapPurchaseOrderItem(sapPurchaseOrderItem); sapPurchaseOrderItemApplication.saveSapPurchaseOrderItem(sapPurchaseOrderItem);
} }
/** /**
* 远程调用sap接口,传递数据 * 远程调用sap接口,传递数据
*/ */
public void sendSapDate(SapPurchaseOrder sapPurchaseOrder,String flag) { public void sendSapDate(SapPurchaseOrder sapPurchaseOrder,String flag) {
Map<String,Object> paramItem = new HashMap<>(); Map<String,Object> paramItem = new HashMap<>();
......
...@@ -29,11 +29,11 @@ public class SapPurchaseOrderItemApplicationImpl extends BaseApplication impleme ...@@ -29,11 +29,11 @@ public class SapPurchaseOrderItemApplicationImpl extends BaseApplication impleme
sapPurchaseOrderItemRepository.save(sapPurchaseOrderItem); sapPurchaseOrderItemRepository.save(sapPurchaseOrderItem);
} }
@Override @Override
public void deleteByIds(List<String> ids) { public void deleteById(String id) {
ids.forEach(id->{
sapPurchaseOrderItemRepository.delete(id); sapPurchaseOrderItemRepository.delete(id);
});
} }
@Override @Override
......
...@@ -47,6 +47,7 @@ public class SapPurchaseOrderController extends CommonController { ...@@ -47,6 +47,7 @@ public class SapPurchaseOrderController extends CommonController {
@RequestMapping( value = "/getSapPurchaseOrder") @RequestMapping( value = "/getSapPurchaseOrder")
@ResponseBody @ResponseBody
public HashMap<String, Object> getSapPurchaseOrder(@RequestBody SapPurchaseOrderVo sapPurchaseOrderVo){ public HashMap<String, Object> getSapPurchaseOrder(@RequestBody SapPurchaseOrderVo sapPurchaseOrderVo){
this.sapPurchaseOrderApplication.saveSapPurchaseOrderVo(sapPurchaseOrderVo); this.sapPurchaseOrderApplication.saveSapPurchaseOrderVo(sapPurchaseOrderVo);
HashMap<String, Object> messageMap = new HashMap<>(); HashMap<String, Object> messageMap = new HashMap<>();
messageMap.put("Message_Status","S"); messageMap.put("Message_Status","S");
...@@ -65,30 +66,17 @@ public class SapPurchaseOrderController extends CommonController { ...@@ -65,30 +66,17 @@ public class SapPurchaseOrderController extends CommonController {
return toResult(map); return toResult(map);
} }
// public String forwardSapPurchaseOrderDetail(){
// this.putAttribute("processDefinitionKey", SapPurchaseOrderApplication.PROCESS_DEFINITION_KEY);
// // 新增的时候procUnitId一定要设置成Apply,不然jsp页面的所有表单元素是readonly状态
// this.putAttribute("procUnitId", "Apply");
// SapPurchaseOrder sapPurchase = new SapPurchaseOrder();
// sapPurchase.setStatusId(BizBillStatus.APPLYING.getId());
// /**
// * 设置jsp页面初始化填充数据,如果不设置, 那么在jsp页面上填写完表单之后立即提交申请TaskDescription获取不到时间和相关人员信息
// */
// Operator operator = getOperator();
// sapPurchase.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
// return forward("sapPurchaseOrderDetail",sapPurchase);
// }
public String showSapPurchaseOrderDetail(){ public String showSapPurchaseOrderDetail(){
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
String id = sdo.getBizId(); String id = sdo.getBizId();
SapPurchaseOrder sapPurchaseOrder = sapPurchaseOrderApplication.loadSapPurchaseOrder(id); SapPurchaseOrder sapPurchaseOrder = sapPurchaseOrderApplication.loadSapPurchaseOrder(id);
SapPurchaseOrderItem purchaseOrderItem = sapPurchaseOrderItemApplication.getPurchaseOrderItem(sapPurchaseOrder.getId()); SapPurchaseOrderItem purchaseOrderItem = sapPurchaseOrderItemApplication.getPurchaseOrderItem(sapPurchaseOrder.getId());
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
//禁止日期类型转换为时间戳
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"));
Map<String, Object> map = objectMapper.convertValue(sapPurchaseOrder, Map.class); Map<String, Object> map = objectMapper.convertValue(sapPurchaseOrder, Map.class);
map.putAll(MyBaseUtil.convertToMap(purchaseOrderItem,false)); map.putAll(MyBaseUtil.convertToMap(purchaseOrderItem));
return forward("sapPurchaseOrderDetail",map); return forward("sapPurchaseOrderDetail",map);
} }
} }
...@@ -38,8 +38,35 @@ public class SapPurchaseOrder extends FlowBillAbstractEntity { ...@@ -38,8 +38,35 @@ public class SapPurchaseOrder extends FlowBillAbstractEntity {
@Column(name = "BATXT") @Column(name = "BATXT")
private String batxt; private String batxt;
/**
* 采购组
*/
@Column(name = "EKGRP")
private String ekgrp;
/**
* 采购组描述
*/
@Column(name = "EKNAM")
private String eknam;
/**
* 币种
*/
@Column(name = "WAERS")
private String waers;
/**
* 创建日期
*/
@Column(name = "AEDAT")
private Date aedat;
@Override @Override
protected String getCodeRuleId() { protected String getCodeRuleId() {
return "sapPurchaseOrder"; return "sapPurchaseOrder";
} }
public void setAedat(String D){
}
} }
\ No newline at end of file
...@@ -132,17 +132,9 @@ public class SapPurchaseOrderItem extends AbstractEntity { ...@@ -132,17 +132,9 @@ public class SapPurchaseOrderItem extends AbstractEntity {
@Column(name = "LGOBE") @Column(name = "LGOBE")
private String lgobe; private String lgobe;
/**
* 采购组
*/
@Column(name = "EKGRP")
private String ekgrp;
/**
* 采购组描述
*/
@Column(name = "EKNAM")
private String eknam;
/** /**
* 价格 * 价格
...@@ -162,11 +154,6 @@ public class SapPurchaseOrderItem extends AbstractEntity { ...@@ -162,11 +154,6 @@ public class SapPurchaseOrderItem extends AbstractEntity {
@Column(name = "MWSKZ") @Column(name = "MWSKZ")
private String mwskz; private String mwskz;
/**
* 币种
*/
@Column(name = "WAERS")
private String waers;
/** /**
* 总价 * 总价
......
...@@ -78,7 +78,7 @@ public class SapPurchaseOrderItemVo { ...@@ -78,7 +78,7 @@ public class SapPurchaseOrderItemVo {
/** /**
* 要求交货日期 * 要求交货日期
*/ */
private Date eindt; private String eindt;
/** /**
* 工厂 * 工厂
...@@ -100,15 +100,9 @@ public class SapPurchaseOrderItemVo { ...@@ -100,15 +100,9 @@ public class SapPurchaseOrderItemVo {
*/ */
private String lgobe; private String lgobe;
/**
* 采购组
*/
private String ekgrp;
/**
* 采购组描述
*/
private String eknam;
/** /**
* 价格 * 价格
...@@ -125,10 +119,7 @@ public class SapPurchaseOrderItemVo { ...@@ -125,10 +119,7 @@ public class SapPurchaseOrderItemVo {
*/ */
private String mwskz; private String mwskz;
/**
* 币种
*/
private String waers;
/** /**
* 总价 * 总价
......
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -29,5 +30,23 @@ public class SapPurchaseOrderVo implements Serializable { ...@@ -29,5 +30,23 @@ public class SapPurchaseOrderVo implements Serializable {
*/ */
private String batxt; private String batxt;
private SapPurchaseOrderItemVo itemVo; private String ernam;
private String nameText;
private String ekgrp;
/**
* 币种
*/
private String waers;
/**
* 采购组描述
*/
private String eknam;
/**
* 创建日期
*/
private String aedat;
private SapPurchaseOrderItemVo item;
} }
...@@ -9,4 +9,6 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -9,4 +9,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description: * @Description:
*/ */
public interface SapPurchaseOrderRepository extends JpaRepository<SapPurchaseOrder,String> { public interface SapPurchaseOrderRepository extends JpaRepository<SapPurchaseOrder,String> {
SapPurchaseOrder findAllByEbeln(String ebeln);
} }
...@@ -130,7 +130,7 @@ public class MyBaseUtil { ...@@ -130,7 +130,7 @@ public class MyBaseUtil {
* 将一个对象转换为Map同时忽略它的基类 * 将一个对象转换为Map同时忽略它的基类
*JsonIgnore 忽略被该注解修饰的字段 *JsonIgnore 忽略被该注解修饰的字段
* @param object 要转换的对象 * @param object 要转换的对象
* @param useAnnoKey 是否使用注解的值作为Map的key * @param useAnnoKey 是否使用注解Column的值作为Map的key
* @return 包含对象所有字段名和值的Map * @return 包含对象所有字段名和值的Map
*/ */
public static Map<String, Object> convertToMap(Object object, boolean useAnnoKey) { public static Map<String, Object> convertToMap(Object object, boolean useAnnoKey) {
...@@ -154,6 +154,15 @@ public class MyBaseUtil { ...@@ -154,6 +154,15 @@ public class MyBaseUtil {
}); });
return map; return map;
} }
/**
* 将一个对象转换为Map同时忽略它的基类
*JsonIgnore 忽略被该注解修饰的字段
* @param object 要转换的对象
* @return 包含对象所有字段名和值的Map
*/
public static Map<String, Object> convertToMap(Object object) {
return convertToMap(object,false);
}
/** /**
* 将输入Map中的所有key转换为大写 * 将输入Map中的所有key转换为大写
......
...@@ -22,15 +22,22 @@ ...@@ -22,15 +22,22 @@
</sql-query> </sql-query>
</query> </query>
<query name="queryBrotherExecute" label="bsn业务人员表" table="bsn_message"> <!-- <query name="queryBrotherExecute" label="bsn业务人员表" table="bsn_message">-->
<!-- <sql-query>-->
<!-- SELECT *-->
<!-- FROM `bsn_message_execute`-->
<!-- WHERE message_sponsor_id = (-->
<!-- SELECT message_sponsor_id-->
<!-- FROM `bsn_message_execute`-->
<!-- WHERE id = :meId-->
<!-- ) AND id != :meId-->
<!-- </sql-query>-->
<!-- </query>-->
<query name="querySystemExecute" label="bsn业务人员表" table="bsn_message">
<sql-query> <sql-query>
SELECT * SELECT *
FROM `bsn_message_execute` FROM `bsn_message_execute`
WHERE message_sponsor_id = ( WHERE message_sponsor_id = ? and business_code='system'
SELECT message_sponsor_id
FROM `bsn_message_execute`
WHERE id = :meId
) AND id != :meId
</sql-query> </sql-query>
</query> </query>
......
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