Commit 93f6728b authored by wanghang's avatar wanghang

非产品物料 切面

parent 9417292f
package com.huigou.topsun.base;
import com.huigou.topsun.base.bsnMessage.appliction.BsnMessageApplication;
import com.huigou.topsun.base.bsnMessage.domain.ActiveStatus;
import com.huigou.topsun.base.bsnMessage.domain.BsnMessageExecute;
import com.huigou.topsun.base.bsnMessage.domain.BsnMessageSponsor;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* 自定义主页"专项任务"板块展示数据
*/
@Aspect
@Component
public class DefinitionHomepageTaskData extends BaseApplication {
@Autowired
BsnMessageApplication bsnMessageApplication;
/**
* 替换原方法方法体
* 主页专项任务数据替换为自定义数据
* @return 当前用户的”专项任务“数据
*/
@Around("execution(public java.util.Map<String, Object> com.huigou.uasp.bpm.engine.application.impl.WorkflowApplicationImpl.queryTrackingTasks())")
public Map<String, Object> replaceQueryTrackingTasks(){
// 当前登录用户是否以任务发起人的身份发起过任务
List<BsnMessageSponsor> messageSponsors = bsnMessageApplication.queryFinishBsnMessageSponsor();
if (!messageSponsors.isEmpty()) {
// 若有发起过任务且所有的执行人执行完毕,则由系统创建一份审批任务给当前用户
for (BsnMessageSponsor sponsor : messageSponsors) {
List<BsnMessageExecute> executes = new ArrayList<>();
if (sponsor.getStatus() == 0) {
// 封装审批任务
BsnMessageExecute execute = new BsnMessageExecute();
execute.setCreateDate(new Date());
execute.setTaskExecute(this.getOperator().getUserId());
execute.setTaskDescribe("[完成]-待审核");
execute.setBusinessCode("system");
execute.setActive(ActiveStatus.UNFINISHED.getValue());
executes.add(execute);
sponsor.setStatus(1);// 发起人审核
sponsor.setExecutes(executes);
// 在同一个任务流程下创建一份发起人自己的审批任务
bsnMessageApplication.saveBsnMessageSponsor(sponsor);
}
}
}
//获取任务执行人为当前用户的任务
return this.bsnMessageApplication.queryExecuteBsnMessage();
}
}
...@@ -11,8 +11,17 @@ public interface BsnMessageApplication { ...@@ -11,8 +11,17 @@ public interface BsnMessageApplication {
String QUERY_XML_FILE_PATH = "config/topsun/base/bsnMessage.xml"; String QUERY_XML_FILE_PATH = "config/topsun/base/bsnMessage.xml";
/**
* 获取当前登录用户未完成或被驳回的任务
* @return 任务执行的详细信息集合
*/
Map<String,Object> queryExecuteBsnMessage(); Map<String,Object> queryExecuteBsnMessage();
/**
* 当前登录用户是否以任务发起人的身份发起过任务如果有
* 且分发到的各单位已完成处理,则返回该任务
* @return 任务发起的详细信息集合
*/
List<BsnMessageSponsor> queryFinishBsnMessageSponsor(); List<BsnMessageSponsor> queryFinishBsnMessageSponsor();
......
package com.huigou.topsun.proofing.domain.workInstruction.model; package com.huigou.topsun.proofing.domain.workInstruction.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
......
...@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -175,14 +176,13 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S ...@@ -175,14 +176,13 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S
// 封装参数
//封装参数
// for (SapStatsIndicatorsDetail sapStatsIndicatorsDetail : all) { // for (SapStatsIndicatorsDetail sapStatsIndicatorsDetail : all) {
// Map<String, Object> detailMap = objectMapper.convertValue(sapStatsIndicatorsDetail, Map.class); // Map<String, Object> detailMap = objectMapper.convertValue(sapStatsIndicatorsDetail, Map.class);
// map.put("ITEM", detailMap); // map.put("ITEM", detailMap);
// list.add(map); // list.add(map);
// } // }
//
// String url = "cud_kb31n/kb31n"; // String url = "cud_kb31n/kb31n";
// SapStatsIndicatorsResult sapStatsIndicatorsResult = null; // SapStatsIndicatorsResult sapStatsIndicatorsResult = null;
// try { // try {
...@@ -209,4 +209,11 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S ...@@ -209,4 +209,11 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S
// } // }
} }
public static void main(String[] args) {
// post.setHeader("Content-type", "application/json;charset=utf-8");
String usernameAndPassword ="rest_user:Bsn123456";
System.out.println("Authorization");
System.out.println( "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()));
}
} }
\ No newline at end of file
...@@ -101,4 +101,12 @@ public class SapCostReimbursementController extends CommonController { ...@@ -101,4 +101,12 @@ public class SapCostReimbursementController extends CommonController {
// sapStatsIndicatorsApplication.sendSapDate(id); // sapStatsIndicatorsApplication.sendSapDate(id);
// return success(); // return success();
// } // }
public String paymentReceipt(){
SDO sdo = this.getSDO();
String id = sdo.getBizId();
return null;
}
} }
\ No newline at end of file
...@@ -186,10 +186,10 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sap ...@@ -186,10 +186,10 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sap
List<SapStatsIndicatorsDetail> all = sapStatsIndicatorsDetailRepository.findAllByStatsIndicatorsId(bizId); List<SapStatsIndicatorsDetail> all = sapStatsIndicatorsDetailRepository.findAllByStatsIndicatorsId(bizId);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> map = MyBaseUtil.convertToMap(sapStatsIndicators,false); Map<String, Object> map = MyBaseUtil.convertToMap(sapStatsIndicators,true);
//封装参数 //封装参数
for (SapStatsIndicatorsDetail sapStatsIndicatorsDetail : all) { for (SapStatsIndicatorsDetail sapStatsIndicatorsDetail : all) {
Map<String, Object> detailMap = objectMapper.convertValue(sapStatsIndicatorsDetail, Map.class); Map<String, Object> detailMap = MyBaseUtil.convertToMap(sapStatsIndicatorsDetail,true);
map.put("ITEM", detailMap); map.put("ITEM", detailMap);
list.add(map); list.add(map);
} }
...@@ -218,5 +218,4 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sap ...@@ -218,5 +218,4 @@ public class SapStatsIndicatorsApplicationImpl extends FlowBroker implements Sap
sapStatsIndicatorsResultRepository.save(sapStatsIndicatorsResult); sapStatsIndicatorsResultRepository.save(sapStatsIndicatorsResult);
} }
} }
} }
\ No newline at end of file
package com.huigou.topsun.util; package com.huigou.topsun.util;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.huigou.topsun.proofing.domain.vo.WorkInstructionVo; import com.huigou.topsun.proofing.domain.vo.WorkInstructionVo;
import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionBaseInfo; import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionBaseInfo;
import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionMaterialInfo; import com.huigou.topsun.proofing.domain.workInstruction.model.WorkInstructionMaterialInfo;
...@@ -103,7 +104,7 @@ public class MyBaseUtil { ...@@ -103,7 +104,7 @@ public class MyBaseUtil {
} }
/** /**
* 处理Bean的非空属性,并将其添加到Map中。 * 剔除Bean的非空属性,并将其添加到Map中。
* 排除class属性。 * 排除class属性。
* *
* @param bean 要处理的Bean对象 * @param bean 要处理的Bean对象
...@@ -127,7 +128,7 @@ public class MyBaseUtil { ...@@ -127,7 +128,7 @@ public class MyBaseUtil {
/** /**
* 将一个对象转换为Map同时忽略它的基类 * 将一个对象转换为Map同时忽略它的基类
* *JsonIgnore 忽略被该注解修饰的字段
* @param object 要转换的对象 * @param object 要转换的对象
* @param useAnnoKey 是否使用注解的值作为Map的key * @param useAnnoKey 是否使用注解的值作为Map的key
* @return 包含对象所有字段名和值的Map * @return 包含对象所有字段名和值的Map
...@@ -136,6 +137,7 @@ public class MyBaseUtil { ...@@ -136,6 +137,7 @@ public class MyBaseUtil {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Class<?> clazz = object.getClass(); Class<?> clazz = object.getClass();
Arrays.stream(clazz.getDeclaredFields()) Arrays.stream(clazz.getDeclaredFields())
.filter(field -> !field.isAnnotationPresent(JsonIgnore.class))
.forEach(field -> { .forEach(field -> {
field.setAccessible(true); field.setAccessible(true);
try { try {
...@@ -180,6 +182,7 @@ public class MyBaseUtil { ...@@ -180,6 +182,7 @@ public class MyBaseUtil {
MyBaseUtil.mergeObjects(workInstructionVo, workInstructionMaterialInfo, workInstructionBaseInfo, null); MyBaseUtil.mergeObjects(workInstructionVo, workInstructionMaterialInfo, workInstructionBaseInfo, null);
Map<String, Object> map = MyBaseUtil.convertBeansToMap(workInstructionMaterialInfo); Map<String, Object> map = MyBaseUtil.convertBeansToMap(workInstructionMaterialInfo);
System.out.println(map);
MyBaseUtil.processNonNullProperties(workInstructionBaseInfo,map); MyBaseUtil.processNonNullProperties(workInstructionBaseInfo,map);
......
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