6 changed files with 251 additions and 129 deletions
@ -0,0 +1,78 @@ |
|||
package com.dreamchaser.depository_manage; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.StockTaking; |
|||
import com.dreamchaser.depository_manage.entity.UserByPort; |
|||
import com.dreamchaser.depository_manage.pojo.*; |
|||
import com.dreamchaser.depository_manage.service.DepositoryRecordService; |
|||
import com.dreamchaser.depository_manage.service.StockTakingService; |
|||
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
|||
public class OtherTest { |
|||
|
|||
@Autowired |
|||
DepositoryRecordService depositoryRecordService; |
|||
|
|||
@Autowired |
|||
StockTakingService stockTakingService; |
|||
@Autowired |
|||
RedisTemplate<String,String> redisTemplateForHash; |
|||
|
|||
@Test |
|||
public void Test(){ |
|||
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null); |
|||
List<SimpleTaskP> userSimpleTaskP = getUserSimpleApplyP(userByPort); |
|||
System.out.println(userSimpleTaskP); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 用于获取当前用户的任务列表 |
|||
* @param userToken 当前用户 |
|||
* @return |
|||
*/ |
|||
public List<SimpleTaskP> getUserSimpleApplyP(UserByPort userToken){ |
|||
Map<String, Object> paramForApply = new HashMap<>(); |
|||
paramForApply.put("applicantId", userToken.getId()); |
|||
paramForApply.put("size", 4); |
|||
paramForApply.put("page", 1); |
|||
|
|||
// 定义任务列表
|
|||
List<SimpleTaskP> list = new ArrayList<>(); |
|||
|
|||
// 查询入库申请
|
|||
List<ApplicationInRecordP> applicationInRecordPByCondition = depositoryRecordService.findApplicationInRecordPByCondition(paramForApply, userToken); |
|||
for (ApplicationInRecordP applicationInRecordP : applicationInRecordPByCondition) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(applicationInRecordP); |
|||
list.add(simpleTask); |
|||
} |
|||
|
|||
|
|||
List<ApplicationOutRecordP> applicationOutRecordPlist = depositoryRecordService.findApplicationOutRecordPByCondition(paramForApply, userToken); |
|||
for (ApplicationOutRecordP applicationOutRecordP : applicationOutRecordPlist) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(applicationOutRecordP); |
|||
list.add(simpleTask); |
|||
} |
|||
|
|||
paramForApply.put("originator",userToken.getId()); |
|||
List<StockTaking> stockTakingByCondition = stockTakingService.findStockTakingByCondition(paramForApply); |
|||
for (StockTaking stockTaking : stockTakingByCondition) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(new SimpleStockTakingP(stockTaking)); |
|||
list.add(simpleTask); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
} |
|||
@ -1,122 +0,0 @@ |
|||
package com.dreamchaser.depository_manage; |
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.alibaba.excel.ExcelWriter; |
|||
import com.alibaba.excel.enums.WriteDirectionEnum; |
|||
import com.alibaba.excel.util.ListUtils; |
|||
import com.alibaba.excel.write.metadata.WriteSheet; |
|||
import com.alibaba.excel.write.metadata.fill.FillConfig; |
|||
import com.alibaba.excel.write.metadata.fill.FillWrapper; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.alibaba.fastjson.JSONPObject; |
|||
import com.dreamchaser.depository_manage.config.PortConfig; |
|||
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|||
import com.dreamchaser.depository_manage.entity.*; |
|||
import com.dreamchaser.depository_manage.mapper.DepositoryMapper; |
|||
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper; |
|||
import com.dreamchaser.depository_manage.mapper.MaterialMapper; |
|||
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP; |
|||
import com.dreamchaser.depository_manage.pojo.RestResponse; |
|||
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo; |
|||
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|||
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details_Approver; |
|||
import com.dreamchaser.depository_manage.service.*; |
|||
import com.dreamchaser.depository_manage.service.impl.QyWxOperationService; |
|||
import com.dreamchaser.depository_manage.utils.CreateQrCodeUtil; |
|||
import com.dreamchaser.depository_manage.utils.HttpUtils; |
|||
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil; |
|||
import com.dreamchaser.depository_manage.utils.ZipMultiFileUtil; |
|||
import javafx.scene.paint.Material; |
|||
import org.apache.http.protocol.HTTP; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.web.jsf.FacesContextUtils; |
|||
|
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.io.UnsupportedEncodingException; |
|||
import java.lang.reflect.Array; |
|||
import java.net.URLEncoder; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import java.util.concurrent.*; |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
public class TestForOther { |
|||
|
|||
|
|||
@Autowired |
|||
AccessAddressService accessAddressService; |
|||
|
|||
|
|||
/** |
|||
* 获取当月的开始和结束时间 |
|||
*/ |
|||
|
|||
|
|||
@Test |
|||
public void run() { |
|||
UserByPort userToken = LinkInterfaceUtil.FindUserById(78, null); |
|||
//定义链接地址
|
|||
String url = PortConfig.external_url_6666 + "/system_authorizing/obtain_authorization"; |
|||
Map<String, Object> param = new HashMap<>(); |
|||
param.put("system", "cangchu"); |
|||
String jsonString = JSONObject.toJSONString(param); |
|||
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|||
String post = null; |
|||
try { |
|||
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userToken); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(post); |
|||
JSONObject data = (JSONObject) jsonObject.get("data"); |
|||
JSONArray powerid = (JSONArray) data.get("powerid"); |
|||
if (powerid == null) { |
|||
powerid = new JSONArray(); |
|||
} |
|||
List<String> stringList = JSONObject.parseArray(powerid.toJSONString(), String.class); |
|||
List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 根据父级菜单获取子菜单 |
|||
* |
|||
* @param accessToAddressByList |
|||
* @param address |
|||
* @return |
|||
*/ |
|||
public List<AccesstoAddress> childAddress(List<AccesstoAddress> accessToAddressByList, AccesstoAddress address) { |
|||
List<AccesstoAddress> accessstoAddressByParent = new ArrayList<>(); |
|||
for (AccesstoAddress accesstoAddress : accessToAddressByList) { |
|||
if (Integer.compare(accesstoAddress.getMenuparent(), address.getId()) == 0) { |
|||
accessstoAddressByParent.add(accesstoAddress); |
|||
} |
|||
} |
|||
return accessstoAddressByParent; |
|||
} |
|||
|
|||
/** |
|||
* 用于菜单构造 |
|||
* |
|||
* @param address |
|||
* @return |
|||
*/ |
|||
public Map<String, Object> MenuConstructor(AccesstoAddress address) { |
|||
Map<String, Object> menu = new HashMap<>(); |
|||
menu.put("title", address.getName()); |
|||
menu.put("href", address.getUrl()); |
|||
menu.put("icon", address.getIcon()); |
|||
menu.put("target", address.getTarget()); |
|||
return menu; |
|||
} |
|||
|
|||
|
|||
} |
|||
Loading…
Reference in new issue