Commit c4d2be67 by zhaoxiaolei

上传下载

parent f9467261
......@@ -19,8 +19,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -30,7 +32,7 @@ import java.util.List;
@RestController
@RequestMapping("/characteristic")
@Api(tags = {"Characteristic 特征管理"})
@ApiIgnore
//@ApiIgnore
public class CharacteristicController {
private static final Logger logger = LoggerFactory.getLogger(CharacteristicController.class);
......@@ -107,4 +109,26 @@ public class CharacteristicController {
}
/**
* @desc 特征管理 导出特征
* @param dto
* @param response
*/
@PostMapping("/exportCharacteristic")
@ApiOperation(value = "特征管理 导出特征", notes = "特征管理 导出特征", httpMethod = "POST")
public void exportCharacteristic(@RequestBody CharacteristicRequestParamDto dto, HttpServletResponse response){
characteristicService.exportCharacteristic(dto,response);
}
/**
* @desc 特征管理 上传文件更新
* @param file
* @return
*/
@RequestMapping("/batchUpdateByUpload")
@ApiOperation(value = "特征管理 上传文件更新", notes = "特征管理 上传文件更新", httpMethod = "POST")
public CrmResponseEntity<?> batchUpdateByUpload(@RequestParam("file") MultipartFile file){
return ResultGenerator.genSuccessResult(characteristicService.batchUpdateByUpload(file));
}
}
......@@ -34,7 +34,7 @@ import java.util.List;
@RestController
@RequestMapping("/characteristicValue")
@Api(tags = {"CharacteristicValue 特征值管理"})
@ApiIgnore
//@ApiIgnore
public class CharacteristicValueController {
private static final Logger logger = LoggerFactory.getLogger(CharacteristicValueController.class);
......@@ -103,8 +103,8 @@ public class CharacteristicValueController {
* @param dto
* @param response
*/
@RequestMapping("/exportCharacteristicValue")
@ApiOperation(value = "特征值管理 导出特征值", notes = "特征值管理 导出特征值", httpMethod = "POST")
@PostMapping("/exportCharacteristicValue")
@ApiOperation(value = "特征值管理 导出特征值", notes = "特征值管理 导出特征值", httpMethod = "GPOSTET")
public void exportCharacteristicValue(@RequestBody CharacteristicValueRequestParamDto dto, HttpServletResponse response){
characteristicValueService.exportCharacteristicValue(dto,response);
}
......
package cn.com.uitech.authorization.controller;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto;
import cn.com.uitech.authorization.pojo.entity.*;
import cn.com.uitech.authorization.service.SuperBomPriceCalculateService;
import cn.com.uitech.authorization.utils.CrmResponseEntity;
......@@ -7,13 +9,12 @@ import cn.com.uitech.authorization.utils.ResultGenerator;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
......@@ -26,7 +27,7 @@ import java.util.Map;
@RestController
@RequestMapping("/superBom")
@Api(tags = {"部件产品价格系数维护"})
@ApiIgnore
//@ApiIgnore
public class SuperBomPriceCalculateController {
@Resource
......@@ -68,4 +69,27 @@ public class SuperBomPriceCalculateController {
public CrmResponseEntity<Object> getPriceByConfigInfo(@RequestBody SuperBomEntity superBomEntity) {
return ResultGenerator.genSuccessResult(superBomPriceCalculateService.getPriceByConfigInfo(superBomEntity));
}
/**
* @desc 特征值价格管理 导出特征值价格
* @param dto
* @param response
*/
@PostMapping("/exportCharacteristicValuePrice")
@ApiOperation(value = "特征值价格管理 导出特征值价格", notes = "特征值价格管理 导出特征值价格", httpMethod = "POST")
public void exportCharacteristicValuePrice(@RequestBody CharacteristicValueExportDto dto, HttpServletResponse response){
superBomPriceCalculateService.exportCharacteristicValuePrice(dto,response);
}
/**
* @desc 特征值价格管理 上传文件更新
* @param file
* @return
*/
@RequestMapping("/batchUpdateByUpload")
@ApiOperation(value = "特征值价格管理 上传文件更新", notes = "特征值价格管理 上传文件更新", httpMethod = "POST")
public CrmResponseEntity<?> batchUpdateByUpload(@RequestParam("file") MultipartFile file){
return ResultGenerator.genSuccessResult(superBomPriceCalculateService.batchUpdateByUpload(file));
}
}
package cn.com.uitech.authorization.mapper;
import cn.com.uitech.authorization.pojo.dto.ApplySkuCodeResultDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto;
import cn.com.uitech.authorization.pojo.entity.*;
import io.swagger.models.auth.In;
......@@ -93,4 +94,8 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
List<Characteristic> getCharacteristicH3CList(String superBomCode);
Integer getCharacteristicInfo(String characteristicCode, String superBomCode);
List<CharacteristicExportDto> exportCharacteristic(CharacteristicRequestParamDto dto);
void updateCharacteristicInfo(Characteristic info);
}
......@@ -107,4 +107,6 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
void saveDeployPlm(SendDataToPlmLog log);
CharacteristicValue getCharacteristicValueInfoByCCode(String isH3cCode, String superBomCode);
void updateCharacteristicValue(CharacteristicValue v);
}
package cn.com.uitech.authorization.mapper;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto;
import cn.com.uitech.authorization.pojo.dto.SuperCharacterPriceInfoDto;
import cn.com.uitech.authorization.pojo.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -46,4 +48,8 @@ public interface SuperBomPriceCalculateMapper {
List<SuperCharacterPriceInfoEntity> getCharacterValueList(CharacteristicValue characteristicValue);
SuperBomPriceInfoEntity getCharacteristicsPrice(String superBomCode, Integer type);
List<SuperCharacterPriceInfoDto> exportCharacteristicValuePrice(CharacteristicValueExportDto dto);
void updateCharacteristicInfo(Characteristics info);
}
package cn.com.uitech.authorization.mapper;
import cn.com.uitech.authorization.pojo.dto.DeployTempItemParam;
import cn.com.uitech.authorization.pojo.dto.DeployTempParam;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TempMapper {
DeployTempParam getTempList();
void updateTemp(DeployTempParam deployTempParam);
List<DeployTempItemParam> getTempListBySkuCode(String oldSkuCode);
}
package cn.com.uitech.authorization.pojo.dto;
import cn.com.uitech.authorization.annotation.FieldNameMapping;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@ToString
public class CharacteristicExportDto implements Serializable {
private static final long serialVersionUID = 587176618049116478L;
/**
* 排序
*/
@FieldNameMapping(name = "sort", value = "排序")
private String sort;
/**
* SuperBOM
*/
@FieldNameMapping(name = "superBomCode", value = "SuperBOM")
private String superBomCode;
/**
* 特征编码
*/
@FieldNameMapping(name = "characteristicCode", value = "特征编码")
private String characteristicCode;
/**
* PLM名称
*/
@FieldNameMapping(name = "characteristicName", value = "PLM名称")
private String characteristicName;
/**
* 销售名称
*/
@FieldNameMapping(name = "unisSalesCName", value = "销售名称")
private String unisSalesCName;
/**
* IsH3C
*/
@FieldNameMapping(name = "isH3C", value = "IsH3C")
private String isH3C;
}
......@@ -4,10 +4,7 @@ import cn.com.uitech.authorization.annotation.BathUpdate;
import cn.com.uitech.authorization.annotation.EditSave;
import cn.com.uitech.authorization.annotation.Query;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.stereotype.Component;
......@@ -23,8 +20,7 @@ import java.io.Serializable;
*/
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@Data
@ToString
public class CharacteristicRequestParamDto extends BasePageDto implements Serializable{
......
package cn.com.uitech.authorization.pojo.dto;
import cn.com.uitech.authorization.annotation.FieldNameMapping;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.stereotype.Component;
import java.io.Serializable;
/**
* @author yangkuo
* @date 2020/6/18 14:37
* @desc 特征值导出实体体
*/
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@Data
@ToString
public class CharacteristicValueExportDto implements Serializable{
private static final long serialVersionUID = 587176618049116478L;
private String brand;
private String productClassCode;
/**
* SuperBOM
*/
@FieldNameMapping(name = "superBomCode", value = "SuperBOM")
private String superBomCode;
/**
* cto 机型名称
* 特征编码
*/
@FieldNameMapping(name = "superBomName",value = "CTO机型名称")
private String superBomName;
@FieldNameMapping(name = "CharacteristicCode", value = "特征编码")
private String characteristicCode;
/**
* 特征名称
*/
@FieldNameMapping(name = "CharacteristicName", value = "特征名称")
private String characteristicName;
/**
* 特征值编码
*/
@FieldNameMapping(name = "characteristicValueCode",value = "特征值编码(请勿修改)")
@FieldNameMapping(name = "CharacteristicValueCode", value = "特征值编码")
private String characteristicValueCode;
/**
* 特征值名称
* PLM名称
*/
@FieldNameMapping(name = "characteristicValueName",value = "特征值名称")
@FieldNameMapping(name = "CharacteristicValueName", value = "PLM名称")
private String characteristicValueName;
/**
* 特征名称
*/
@FieldNameMapping(name = "characteristicName",value = "特征名称")
private String characteristicName;
/**
* cto 物料编号
* 销售名称
*/
@FieldNameMapping(name = "superBomCode",value = "产品BOM")
private String superBomCode;
@FieldNameMapping(name = "unisSalesVName", value = "销售名称")
private String unisSalesVName;
/**
* 特征值是否可卖
* 是否可卖
*/
@FieldNameMapping(name = "isState",value = "可卖状态")
@FieldNameMapping(name = "isState", value = "是否可卖")
private String isState;
/**
* 是否可见
* ZPHCode
*/
@FieldNameMapping(name = "isShow",value = "可见状态")
private String isShow;
@FieldNameMapping(name = "zphCode", value = "ZPHCode")
private String zphCode;
/**
* cto 是否可卖
* ZPHName
*/
@FieldNameMapping(name = "bomStatus",value = "CTO机型可卖")
private String bomStatus;
@FieldNameMapping(name = "zphName", value = "ZPHName")
private String zphName;
/**
* 产品组
* 开始时间
*/
@FieldNameMapping(name = "productClassCode",value = "产品组")
private String productClassCode;
@FieldNameMapping(name = "qualifyDate", value = "开始时间")
private String qualifyDate;
/**
* 产品组
* H3C对照关系
*/
@FieldNameMapping(name = "productClassName",value = "产品组")
private String productClassName;
@FieldNameMapping(name = "h3cCValue", value = "H3C对照关系")
private String h3cCValue;
private String h3cDeliverCode;
}
package cn.com.uitech.authorization.pojo.dto;
import cn.com.uitech.authorization.annotation.FieldNameMapping;
import lombok.Data;
import java.math.BigDecimal;
import java.sql.Date;
@Data
public class SuperCharacterPriceInfoDto {
private String cvPriceId;
@FieldNameMapping(name = "superBomCode", value = "SuperBOM")
private String superBomCode;
@FieldNameMapping(name = "superBomName", value = "SuperBOM名称")
private String superBomName;
@FieldNameMapping(name = "priceType", value = "定价类型")
private String priceType;
@FieldNameMapping(name = "characterCode", value = "特征编号")
private String characterCode;
@FieldNameMapping(name = "characterName", value = "特征名称")
private String characterName;
@FieldNameMapping(name = "characterValueCode", value = "特征值编号")
private String characterValueCode;
@FieldNameMapping(name = "characterValueName", value = "特征值名称")
private String characterValueName;
@FieldNameMapping(name = "actualPrice", value = "真实成本")
private String actualPrice;
@FieldNameMapping(name = "leve0Price", value = "标准成本")
private String leve0Price;
@FieldNameMapping(name = "leve1Price", value = "一级调整价")
private String leve1Price;
@FieldNameMapping(name = "leve2Price", value = "二级调整价")
private String leve2Price;
@FieldNameMapping(name = "leve3Price", value = "三级调整价")
private String leve3Price;
@FieldNameMapping(name = "leve4Price", value = "四级调整价")
private String leve4Price;
@FieldNameMapping(name = "agentPrice", value = "代理价")
private String agentPrice;
}
......@@ -24,6 +24,7 @@ public class Characteristics {
private String unisSalesVName;
private String h3cCValue;
private String h3cCName;
private String superBomCode;
/**
* 真实成本价
*/
......
package cn.com.uitech.authorization.pojo.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;
/**
......@@ -32,5 +34,7 @@ public class SuperCharacterPriceInfoEntity {
private BigDecimal leve4Price;
private BigDecimal agentPrice;
private String updateUser;
private Date updateTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Timestamp updateTime;
}
......@@ -21,7 +21,7 @@ public class UserInfo {
@Column(name = "user_code")
private String userCode;
@Column(name = "pass_word")
private String passWord;
private String password;
@Column(name = "user_name")
private String userName;
@Column(name = "user_dimension")
......
......@@ -5,7 +5,9 @@ import cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto;
import cn.com.uitech.authorization.pojo.entity.Characteristic;
import com.github.pagehelper.PageInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -55,4 +57,7 @@ public interface CharacteristicService {
Object updateCharacteristicIsH3C(CharacteristicRequestParamDto dto);
void exportCharacteristic(CharacteristicRequestParamDto dto, HttpServletResponse response);
Object batchUpdateByUpload(MultipartFile file);
}
package cn.com.uitech.authorization.service;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto;
import cn.com.uitech.authorization.pojo.entity.*;
import com.github.pagehelper.PageInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* @Author: ZXN
......@@ -32,4 +36,8 @@ public interface SuperBomPriceCalculateService {
* @return
*/
PageInfo<SuperCharacterPriceInfoEntity> getCharacterValueList(CharacteristicValue characteristicValue);
void exportCharacteristicValuePrice(CharacteristicValueExportDto dto, HttpServletResponse response);
Object batchUpdateByUpload(MultipartFile file);
}
......@@ -165,6 +165,7 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristic.setUnisSalesCName(saveSuperCharacterInputDto.getOptionName());
characteristic.setIsShow(1);
characteristic.setIsHidden(1);
characteristic.setIsH3C(0);
characteristic.setCharacteristicType("否");
Characteristic getOne = characteristicMapper.selectByCode(characteristic);
if (!ObjectUtils.isEmpty(getOne)) {
......@@ -683,15 +684,15 @@ public class IntegrateServiceImpl implements IntegrateService {
GetProductOutDto result = new GetProductOutDto();
UserInfo getOne = userInfoMapper.getUser(userinfo);
if (!ObjectUtils.isEmpty(getOne)) {
String redis = redisHelper.get("unis_cpq:" + getOne.getUserCode());
String redis = redisHelper.get("unis_cpq:" + getOne.getUserCode().toUpperCase());
if (StringUtils.isEmpty(redis)) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(System.currentTimeMillis());
String md5Str = MD5Util.getMD5Str(getOne.getPassWord() + "_unis_cpq_" + getOne.getUserCode() + formatter.format(date));
String md5Str = MD5Util.getMD5Str(getOne.getPassword() + "_unis_cpq_" + getOne.getUserCode() + formatter.format(date));
String doubleMd5 = MD5Util.getMD5Str(md5Str);
result.setData(doubleMd5);
result.setCode(200);
redisHelper.set("unis_cpq:" + getOne.getUserCode(), doubleMd5, 86400);
redisHelper.set("unis_cpq:" + getOne.getUserCode().toUpperCase(), doubleMd5, 86400);
} else {
result.setData(redis);
result.setCode(200);
......@@ -736,7 +737,7 @@ public class IntegrateServiceImpl implements IntegrateService {
GetProductOutDto result = new GetProductOutDto();
UserInfo getOne = userInfoMapper.getUserOne(userinfo);
if (!ObjectUtils.isEmpty(getOne)) {
String redis = redisHelper.get("unis_cpq:" + userinfo.getUserCode());
String redis = redisHelper.get("unis_cpq:" + userinfo.getUserCode().toUpperCase());
if (!StringUtils.isEmpty(redis)) {
if (userinfo.getToken().equals(redis)) {
result.setMsg(null);
......@@ -763,18 +764,18 @@ public class IntegrateServiceImpl implements IntegrateService {
public Object ldapAuth(UserInfo userinfo) {
GetProductOutDto result = new GetProductOutDto();
EqualsFilter filter = new EqualsFilter("sAMAccountName", userinfo.getUserCode());
boolean authenticate = ldapTemplate.authenticate("", filter.toString(), userinfo.getPassWord());
boolean authenticate = ldapTemplate.authenticate("", filter.toString(), userinfo.getPassword());
//true 存在
if (authenticate) {
String redis = redisHelper.get("unis_cpq:" + userinfo.getUserCode());
String redis = redisHelper.get("unis_cpq:" + userinfo.getUserCode().toUpperCase());
if (StringUtils.isEmpty(redis)) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(System.currentTimeMillis());
String md5Str = MD5Util.getMD5Str(userinfo.getPassWord() + "_unis_cpq_" + userinfo.getUserCode() + formatter.format(date));
String md5Str = MD5Util.getMD5Str(userinfo.getPassword() + "_unis_cpq_" + userinfo.getUserCode() + formatter.format(date));
String doubleMd5 = MD5Util.getMD5Str(md5Str);
result.setData(doubleMd5);
result.setCode(200);
redisHelper.set("unis_cpq:" + userinfo.getUserCode(), doubleMd5, 86400);
redisHelper.set("unis_cpq:" + userinfo.getUserCode().toUpperCase(), doubleMd5, 86400);
//用于代码校验token
//redisHelper.set("unis_cpq:" + doubleMd5, doubleMd5, 86400);
} else {
......
......@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
@Service
@Transactional
public class TempServiceImpl implements TempServer {
@Autowired
......@@ -37,6 +36,8 @@ public class TempServiceImpl implements TempServer {
GetProductOutDto result = new GetProductOutDto();
//获取未开始的信息进行操作
DeployTempParam deployTempParam = tempMapper.getTempList();
List<DeployTempItemParam> deployTempItemParamList = tempMapper.getTempListBySkuCode(deployTempParam.getOldSkuCode());
deployTempParam.setDeployTempItemParams(deployTempItemParamList);
if(!ObjectUtils.isEmpty(deployTempParam)){
//循环生成configid,保存sku信息,申请sku
//构建生成配置参数
......@@ -103,6 +104,8 @@ public class TempServiceImpl implements TempServer {
JSONObject data = (JSONObject) map.get("data");
result.setCode(200);
result.setData(data);
deployTempParam.setStatus("已完成");
tempMapper.updateTemp(deployTempParam);
} else {
String msg = (String) map.get("msg");
......@@ -120,11 +123,12 @@ public class TempServiceImpl implements TempServer {
result.setMsg(msg);
}
}
getTempList();
}else{
result.setCode(200);
result.setMsg("数据初始化完成");
return result;
}
getTempList();
return result;
}
}
package cn.com.uitech.authorization.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUitl {
public static final String PATTERN_DATE_1 = "yyyy-MM-dd";
public static final String PATTERN_DATE_2 = "HH:mm:ss";
public static final String PATTERN_DATE_3 = "yyyy-MM-dd HH:mm:ss";
private DateUitl() {
}
public static String getPreDay(String dateString, int i) throws ParseException{
Date day=parseDate(dateString,DateUitl.PATTERN_DATE_1);
Calendar cal=Calendar.getInstance();
cal.setTime(day);
cal.add(cal.DAY_OF_MONTH,-i);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
String str = format(date, DateUitl.PATTERN_DATE_1);
System.err.println(str);
return str;
}
public static String getNextDay(String dateString, int i) throws ParseException{
Date day=parseDate(dateString,DateUitl.PATTERN_DATE_1);
Calendar cal=Calendar.getInstance();
cal.setTime(day);
cal.add(cal.DAY_OF_MONTH,i);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
String str = format(date, DateUitl.PATTERN_DATE_1);
return str;
}
// 将字符串类型格式化为日期类型
public static Date parseDate(String dateString, String pattern) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date date = null;
try {
date = sdf.parse(dateString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return date;
}
// 将日期类型格式化为字符串类型
public static String format(Date date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
}
// 获取当前系统时间(字符串类型)
public static String getCurrentDate() {
return format(new Date(), DateUitl.PATTERN_DATE_3);
}
// 获取当前系统时间(字符串类型)
public static String getCurrentDate(String pattern) {
return format(new Date(), pattern);
}
// 得到当前系统时间,包含年、月、日、时、分、秒
public static Date getNowAll() throws ParseException {
return parseDate(getCurrentDate(), DateUitl.PATTERN_DATE_3);
}
// 得到当前系统时间,包含年、月、日
public static Date getNowDate() throws ParseException {
return parseDate(getCurrentDate(), DateUitl.PATTERN_DATE_1);
}
/**
* 得到当前日期的前一天
* @throws ParseException
* */
@SuppressWarnings("static-access")
public static Date getPreDay() throws ParseException {
Calendar cal = Calendar.getInstance();
cal.add(cal.DAY_OF_MONTH, -1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
return date;
}
@SuppressWarnings("static-access")
public static String getPreDay(int i) throws ParseException {
Calendar cal = Calendar.getInstance();
cal.add(cal.DAY_OF_MONTH, i);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
String str = format(date, DateUitl.PATTERN_DATE_1);
return str;
}
/**
* 得到当前日期的 后一天
* @throws ParseException
* */
@SuppressWarnings("static-access")
public static Date getNextDay() throws ParseException {
Calendar cal = Calendar.getInstance();
cal.add(cal.DAY_OF_MONTH, 1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
return date;
}
@SuppressWarnings("static-access")
public static String getNextDay(int i) throws ParseException {
Calendar cal = Calendar.getInstance();
cal.add(cal.DAY_OF_MONTH, i);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime = formatter.format(cal.getTime());
Date date = parseDate(mDateTime, DateUitl.PATTERN_DATE_1);
String str = format(date, DateUitl.PATTERN_DATE_1);
return str;
}
/**
* 得到当天星期几,用(1234567)表示
* */
@SuppressWarnings("deprecation")
public static int getWeekDate() {
Date date = new Date();
int weekDate = date.getDay();
if (weekDate == 0) {
weekDate = 7;
}
return weekDate;
}
/**
* 得到当天星期几,用(1234567)表示
* @param handleDate 传入日期
* @return
* int
*/
@SuppressWarnings("deprecation")
public static int getWeekDate(Date handleDate) {
int weekDate = handleDate.getDay();
if (weekDate == 0) {
weekDate = 7;
}
return weekDate;
}
/***
* 比较两个时间相差的分钟数。
*
* @param:firstTime 比较小的时间 secondTime 比较大的时间
* @return:Integer :分钟数
* */
public static Long compare(Date firstTime, Date secondTime) {
Long minutes = (secondTime.getTime() - firstTime.getTime())
/ (1000 * 60);
return minutes;
}
/**
* 比较两个时间相差的天数
* @param firstTime
* @param secondTime
* @return
* Long
*/
public static Long compareOfDay(Date firstTime, Date secondTime) {
Long days = (secondTime.getTime() - firstTime.getTime())
/ (1000 * 60*60*24);
return days;
}
/**
* 获取当前日期所在的星期几
*
* @param currentDate
* @since 1.0.0
*/
public static int getDayOfWeek(Date currentDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(currentDate);
// 获取当天所在的星期
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK) - 1;
// 处理周日
if (dayOfWeek == 0) {
dayOfWeek = 7;
}
return dayOfWeek;
}
@SuppressWarnings("static-access")
public static String getDayOfWeekInfo(int i) {
String result = "";
switch (i) {
case 1:
result = "星期一";
break;
case 2:
result = "星期二";
break;
case 3:
result = "星期三";
break;
case 4:
result = "星期四";
break;
case 5:
result = "星期五";
break;
case 6:
result = "星期六";
break;
default:
result = "星期日";
break;
}
return result;
}
}
......@@ -12,6 +12,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
......@@ -277,7 +278,7 @@ public class ProductExportUtils {
* @param list 表中元素
* @return
*/
public static SXSSFWorkbook getSXSSFWorkbook(String sheetName, ArrayList<String> titList,List<String[]> list){
public static SXSSFWorkbook getSXSSFWorkbook(String sheetName, ArrayList<String> titList,List<String[]> list,Integer temp){
//创建一个HSSFWorkbook,对应一个Excel文件
SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook();
//在workbook中添加一个sheet,对应Excel文件中的sheet
......@@ -288,13 +289,20 @@ public class ProductExportUtils {
long timeInMillis = Calendar.getInstance().getTimeInMillis();
//给可卖可见增加下拉效果
String[] status = new String[]{"可卖","不可卖"};
String[] visible = new String[]{"PM可见","全部可见","隐藏"};
DataValidation dataValidation = getDataValidation(sheet,status,1, list.size(),5);
DataValidation dataValidation1 = getDataValidation(sheet,visible, 1, list.size(), 6);
sheet.addValidationData(dataValidation);
sheet.addValidationData(dataValidation1);
if(!ObjectUtils.isEmpty(temp)){
if(temp == 1){
//给可卖可见增加下拉效果
String[] status = new String[]{"是","否"};
DataValidation dataValidation = getDataValidation(sheet,status,1, list.size(),5);
sheet.addValidationData(dataValidation);
}else if(temp == 2){
//给可卖可见增加下拉效果
String[] status = new String[]{"可卖","不可卖"};
DataValidation dataValidation = getDataValidation(sheet,status,1, list.size(),6);
sheet.addValidationData(dataValidation);
}
}
//产生表头
Row row1 = sheet.createRow(0);
......
......@@ -233,4 +233,40 @@
<select id="getCharacteristicInfo" resultType="java.lang.Integer">
select is_h3c isH3C from super_characteristic_info where characteristic_Code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select>
<select id="exportCharacteristic" resultType="cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto">
select
sort,
a.super_bom_code as superBomCode,
characteristic_code as characteristicCode,
characteristic_name as characteristicName,
unis_sales_c_name as unisSalesCName,
case when is_h3c = 0
then '否'
else '是'
end as isH3C
from
super_characteristic_info a
left join super_bom_info b on a.super_bom_code = b.super_bom_code
<where>
<if test="superBomCode!='' and superBomCode != null">
a.super_bom_code = #{superBomCode}
</if>
<if test="productClassCode!=null and productClassCode!=''">
AND b.product_class_code=#{productClassCode}
</if>
<if test="brand!=null and brand!=''">
AND b.brand=#{brand}
</if>
<if test="characteristicCode!=null and characteristicCode!=''">
AND a.characteristic_code=#{characteristicCode}
</if>
</where>
order by sort asc
</select>
<update id="updateCharacteristicInfo">
update super_characteristic_info set is_h3c = #{isH3C} , unis_sales_c_name = #{unisSalesCName} , sort = #{sort}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode}
</update>
</mapper>
......@@ -162,53 +162,44 @@
<select id="exportCharacteristicValue"
parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto"
resultType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto">
SELECT *
FROM (
SELECT
c.super_bom_NAME AS "bomName",
a.Characteristic_Value_Code as CharacteristicValueCode,
c.super_bom_Code as superBomCode,
c.product_class_code as productClassCode,
d.product_class_name as productClassName,
case when a.is_sate=1 then '可卖'
else '不可卖' end as "isStatus",
case when a.isShow=1 then '全部可见'
when a.isShow=2 then 'PM可见'
when a.isShow=3 then '隐藏'
end as "isShow",
case when c.is_state=1 then '可卖'
else '不可卖' end as "bomStatus",
a.characteristic_value_name as characteristicValueName,
b.characteristic_name as characteristicName
FROM super_characteristic_value_info a
LEFT JOIN super_characteristic_info b ON a.Characteristic_Code=b.Characteristic_Code
LEFT JOIN super_bom_info c ON characteristic.BOMCode=configurablebom.BOMCode
LEFT JOIN a_productclasscode d on d.product_class_code=c.product_class_code
SELECT DISTINCT
a.super_bom_code as superBomCode,
a.Characteristic_Code as CharacteristicCode,
b.unis_Sales_C_Name as CharacteristicName,
A.Characteristic_Value_Code AS CharacteristicValueCode,
A.Characteristic_Value_name AS CharacteristicValueName,
A.unis_Sales_V_Name AS unisSalesVName,
CASE
WHEN A.is_state = 1 THEN
'可卖' ELSE'不可卖'
END AS "isState",
A.zph_Code AS zphCode,
A.zph_Name AS zphName,
A.qualify_Date AS qualifyDate,
A.h3c_C_Value AS h3cCValue,
b.sort
FROM
super_characteristic_value_info
A LEFT JOIN super_characteristic_info b ON A.Characteristic_Code = b.Characteristic_Code
LEFT JOIN super_bom_info C ON b.super_BOM_Code = c.super_BOM_Code
<where>
1=1
<if test="productClassCode!=null and productClassCode!=''">
AND c.Product_class_Code=#{productClassCode}
c.Product_class_Code=#{productClassCode}
</if>
<if test="characteristicCode!=null and characteristicCode!=''">
and a.Characteristic_Code=#{characteristicCode}
</if>
<if test="characteristicValueCode!=null and characteristicValueCode!=''">
and a.Characteristic_Value_Code like CONCAT('%','${characteristicValueCode}','%')
and a.Characteristic_Value_Code = #{characteristicValueCode}
</if>
<if test="superBomCode!=null and superBomCode!=''">
and c.super_bom_code=#{superBomCode}
and a.super_bom_code=#{superBomCode}
</if>
<if test="characteristicValueName!=null and characteristicValueName!=''">
and a.characteristic_value_name like CONCAT('%','${characteristicValueName}','%')
</if>
<if test="bomStatus!=null">
and c.is_state=#{bomStatus}
</if>
<if test="status!=null">
and a.is_state=#{status}
<if test="brand!=null and brand!=''">
and c.brand = #{brand}
</if>
</where>
)a
order by b.sort asc
</select>
......@@ -346,4 +337,9 @@
where h3c_c_value = #{h3cVCode}
and super_bom_code = #{h3cPn}
</select>
<update id="updateCharacteristicValue">
update super_characteristic_value_info set unis_sales_v_name = #{unisSalesVName},h3c_c_value = #{h3cCValue}, h3c_Deliver_Code = #{h3cDeliverCode}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode} and characteristic_Value_Code = #{characteristicValueCode}
</update>
</mapper>
......@@ -136,4 +136,70 @@
</if>
</where>
</select>
<select id="exportCharacteristicValuePrice"
resultType="cn.com.uitech.authorization.pojo.dto.SuperCharacterPriceInfoDto">
select a.super_bom_name as superBomName,
a.super_bom_code as superBomCode,
b.characteristic_code AS characterCode,
b.characteristic_name AS characterName,
c.characteristic_value_name AS characterValueName,
c.characteristic_value_code AS characterValueCode,
case when d.price_type = 1
then '成本定价法'
else '市场定价法'
end as priceType,
e.actual_price AS actualPrice,
e.leve0_price AS leve0Price,
e.leve1_price AS leve1Price,
e.leve2_price AS leve2Price,
e.leve3_price AS leve3Price,
e.leve4_price AS leve4Price,
e.agent_price AS agentprice,
b.sort
from super_bom_info a
inner join super_characteristic_info b
on a.super_bom_code = b.super_bom_code
inner join super_characteristic_value_info c
on a.super_bom_code = c.super_bom_code and b.characteristic_code = c.characteristic_code
-- 查系数
inner join basics_price_info d on a.super_bom_code = d.super_bom_code
and a.brand = d.brand
and a.product_class_code = d.product_class_code
left join super_character_price_info e on a.super_bom_code = e.super_bom_code
and b.characteristic_code = e.character_code and c.characteristic_value_code = e.character_value_code
<where>
<if test="superBomCode != null and superBomCode != ''.toString()">
a.super_bom_code = #{superBomCode}
</if>
<if test="characteristicValueCode != null and characteristicValueCode != ''.toString()">
and c.characteristic_value_code like CONCAT('%','${characteristicValueCode}','%')
</if>
<if test="characteristicCode != null and characteristicCode != ''.toString()">
and b.characteristic_code = #{characteristicCode}
</if>
<if test="brand != null and brand != ''.toString()">
and a.brand = #{brand}
</if>
<if test="productClassCode != null and productClassCode != ''.toString()">
and a.product_class_code = #{productClassCode}
</if>
</where>
order by b.sort asc
</select>
<update id="updateCharacteristicInfo">
update super_character_price_info set
agent_Price = #{agentPrice} ,
actual_Price = #{actualPrice} ,
leve0_price =#{leve0Price},
leve1_price = #{leve1Price},
leve2_price = #{leve2Price},
leve3_price = #{leve3Price},
leve4_price = #{leve4Price},
update_time = now()
where super_bom_code = #{superBomCode}
and character_Code = #{characteristicCode}
and character_Value_Code = #{characteristicValueCode}
</update>
</mapper>
......@@ -21,12 +21,16 @@
<result property="characteristicValueName" column="characteristic_value_name"/>
</collection>
</resultMap>
<select id="getTempList" resultMap="DeployTempMap">
select * from deploy_temp a left join deploy_temp_item b on a.old_sku_code = b.old_sku_code
where a.status = '未开始'
<select id="getTempList" resultType="cn.com.uitech.authorization.pojo.dto.DeployTempParam">
select * from deploy_temp
where status = '未开始' limit 1
</select>
<update id="updateTemp">
update deploy_temp set description = #{description} , status = #{status} where old_sku_code = #{oldSkuCode}
</update>
<select id="getTempListBySkuCode" resultType="cn.com.uitech.authorization.pojo.dto.DeployTempItemParam">
select * from deploy_temp_item where old_sku_code = #{oldSkuCode}
</select>
</mapper>
\ No newline at end of file
......@@ -4,7 +4,7 @@
<mapper namespace="cn.com.uitech.authorization.mapper.UserInfoMapper">
<select id="getUser" resultType="cn.com.uitech.authorization.pojo.entity.UserInfo">
select * from user_info where user_code = #{userCode} and pass_word = #{passWord}
select * from user_info where user_code = #{userCode} and pass_word = #{password}
</select>
<select id="getUserDimension" resultType="cn.com.uitech.authorization.pojo.entity.MenuInfo">
......@@ -15,7 +15,7 @@
user_menu_info
A LEFT JOIN menu_info b ON A.menu_id = b.menu_id
WHERE
A.user_code = #{userCode}
upper(A.user_code) = upper(#{userCode})
</select>
<select id="getUserOne" resultType="cn.com.uitech.authorization.pojo.entity.UserInfo">
......
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