|
@@ -7,9 +7,11 @@ import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.dto.GoodsSellDto;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
import com.ym.mec.biz.dal.entity.GoodsProcurement;
|
|
|
+import com.ym.mec.biz.dal.entity.Organization;
|
|
|
import com.ym.mec.biz.dal.entity.SellOrder;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.GoodsQuery;
|
|
|
+import com.ym.mec.biz.dal.page.GoodsQueryInfo;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.UploadReturnBean;
|
|
@@ -18,6 +20,7 @@ import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
+import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
|
import com.ym.mec.util.ini.IniFileUtil;
|
|
|
|
|
@@ -69,6 +72,88 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<Goods> exportGoods(GoodsQueryInfo queryInfo) {
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ List<Goods> rows = goodsDao.exportGoods(params);
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ throw new BizException("没有查询到商品信息");
|
|
|
+ }
|
|
|
+ List<Organization> all = organizationDao.findAll(params);
|
|
|
+ Map<Integer, String> organizationMap = all.stream().collect(Collectors.toMap(Organization::getId, Organization::getName));
|
|
|
+ for (Goods goods : rows) {
|
|
|
+ if(StringUtils.isNotEmpty(goods.getStudentShowOrganId())){
|
|
|
+ String[] split = goods.getStudentShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setStudentShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(goods.getEducationShowOrganId())){
|
|
|
+ String[] split = goods.getEducationShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setEducationShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(goods.getReplacementShowOrganId())){
|
|
|
+ String[] split = goods.getReplacementShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setReplacementShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(goods.getCourseFeeShowOrganId())){
|
|
|
+ String[] split = goods.getCourseFeeShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setCourseFeeShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(goods.getMemberFeeShowOrganId())){
|
|
|
+ String[] split = goods.getMemberFeeShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setMemberFeeShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(goods.getFreeFeeShowOrganId())){
|
|
|
+ String[] split = goods.getFreeFeeShowOrganId().split(",");
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (String s : split) {
|
|
|
+ if(sb.length() > 0){
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ sb.append(organizationMap.get(Integer.valueOf(s)));
|
|
|
+ }
|
|
|
+ goods.setFreeFeeShowOrganName(sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
|
|
|
public void addGoods(Goods goods, Integer operatorId) {
|
|
|
if(StringUtils.isBlank(goods.getSn())){
|