Commit 53d387db authored by kinky2014's avatar kinky2014

增加气瓶单位数据

parent 34b5fbfa
......@@ -41,10 +41,11 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableAsync
@EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao",
@MapperScan(basePackages = { "org.typroject.tyboot.*.*.face.orm.dao",
"com.yeejoin.amos.api.*.face.orm.dao",
"org.typroject.tyboot.face.*.orm.dao*",
"com.yeejoin.amos.boot.module.cylinder.api.mapper",
"com.yeejoin.amos.boot.module.cylinder.flc.api.mapper",
"com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" }, excludeFilters = @ComponentScan.Filter(
type = FilterType.REGEX,
......
......@@ -14,8 +14,8 @@ public abstract class AbstractBaseModel extends BaseModel{
*
*/
private static final long serialVersionUID = 1L;
protected Date SyncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
protected int SyncState;//同步状态(0-新增 1-更新 2-删除)
protected Date syncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
protected int syncState;//同步状态(0-新增 1-更新 2-删除)
/**
* 对接公司编码
*/
......
......@@ -12,6 +12,6 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderDateInfo;
* @author gwb
* @version $Id: ElevatorMapper.java, v 0.1 2021年9月30日 下午3:28:31 gwb Exp $
*/
public interface CylinderDateInfoMapper extends BaseMapper<CylinderDateInfo> {
public interface TmCylinderDateInfoMapper extends BaseMapper<CylinderDateInfo> {
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.api.openapi.face.model.EquipmentModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.Equipment;
public interface EquipmentMapper extends BaseMapper<Equipment> {
public interface TmEquipmentMapper extends BaseMapper<Equipment> {
IPage<EquipmentModel> page(Page<EquipmentModel> page, Date startTime,Date endTime);
......
......@@ -6,7 +6,7 @@ import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderDateInfoModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTableModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.CylinderDateInfoMapper;
import com.yeejoin.amos.api.openapi.face.orm.dao.TmCylinderDateInfoMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderDateInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFilling;
import com.yeejoin.amos.api.openapi.face.orm.entity.TmCylinderFillingCheck;
......@@ -45,7 +45,7 @@ import java.util.List;
* @version $Id: ElevatorService.java, v 0.1 2021年9月30日 下午3:28:55 gwb Exp $
*/
@Component
public class CylinderDateInfoService extends BaseService<CylinderDateInfoModel, CylinderDateInfo, CylinderDateInfoMapper> {
public class CylinderDateInfoService extends BaseService<CylinderDateInfoModel, CylinderDateInfo, TmCylinderDateInfoMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
......
......@@ -8,15 +8,15 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.api.openapi.face.model.EquipmentModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.EquipmentMapper;
import com.yeejoin.amos.api.openapi.face.orm.dao.TmEquipmentMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.Equipment;
import com.yeejoin.amos.api.openapi.face.orm.entity.PageParam;
@Service
public class EquipmentService extends AppBaseService<EquipmentModel, Equipment, EquipmentMapper> {
public class EquipmentService extends AppBaseService<EquipmentModel, Equipment, TmEquipmentMapper> {
@Autowired
EquipmentMapper equipmentMapper;
TmEquipmentMapper equipmentMapper;
public IPage<EquipmentModel> page(PageParam pageParam, Date startTime,Date endTime) {
Page<EquipmentModel> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
......
package com.yeejoin.amos.api.openapi.face.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -16,12 +17,15 @@ import java.util.List;
@Component
public class SyncCylinderDataService
// extends ServiceImpl implements IService
{
@Autowired
public CylinderUnitMapper cylinderUnitMapper;
@DS("tzs")
public void syncCylinderUnit(List<CylinderUnitDto> cylinderUnitDto) {
// List<CylinderUnit> cylinderUnits = Bean.toModels(cylinderUnitDto,CylinderUnit.class);
// LambdaQueryWrapper<CylinderUnit> wrapper = new LambdaQueryWrapper<>();
// List<CylinderUnit> cylinderUnitList = this.getBaseMapper().selectList(wrapper);
List<CylinderUnit> cylinderUnitList = Bean.toModels(cylinderUnitDto,CylinderUnit.class);
cylinderUnitMapper.saveOrUpdateBatch(cylinderUnitList);
}
}
......@@ -39,11 +39,11 @@ public class TmCylinderUnitService extends BaseService<TmCylinderUnitModel, TmCy
private RedisTemplate redisTemplate;
@Autowired
private SyncCylinderDataService syncCylinderDataService;
@Transactional(rollbackFor= {Exception.class})
@Transactional(rollbackFor= {Exception.class})
public String createCylinderUnit(List<TmCylinderUnitModel> model) {
if (ValidationUtil.isEmpty(model))
throw new BadRequest("气瓶企业信息数据为空.");
syncCylinderUnitModel(model);
for (TmCylinderUnitModel cylinderUnitModel : model) {
cylinderUnitModel.setRecDate(new Date());
cylinderUnitModel.setAppId(getAppId());
......@@ -51,6 +51,7 @@ public class TmCylinderUnitService extends BaseService<TmCylinderUnitModel, TmCy
}
return "OK";
}
@Transactional(rollbackFor= {Exception.class})
private void syncCylinderUnitModel(List<TmCylinderUnitModel> model ) {
List<CylinderUnitDto> cylinderUnitDto = Bean.toModels(model,CylinderUnitDto.class);
syncCylinderDataService.syncCylinderUnit(cylinderUnitDto);
......
......@@ -9,7 +9,7 @@ spring.servlet.multipart.maxRequestSize=3MB
## redis失效时间
redis.cache.failure.time=10800
# mybatis-plus
mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
mybatis-plus.mapper-locations=classpath*:mapper/*Mapper.xml
mybatis-plus.type-aliases-super-type=org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
mybatis-plus.global-config.db-config.id-type=ID_WORKER
spring.main.allow-bean-definition-overriding=true
......@@ -105,7 +105,7 @@ public class CylinderUnitDto extends BaseDto {
private String evaluate;
private boolean outOfDate = false;
private Boolean outOfDate = false;
@ApiModelProperty(value = "技术服务商")
private String developerAgency;
......
......@@ -55,4 +55,5 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> {
* @return list
*/
List<CityCylinderInfoDto> getCylinderDataByLevel(@Param("level") String level);
void saveOrUpdateBatch(@Param("list") List<CylinderUnit> list);
}
......@@ -65,4 +65,46 @@
FROM tz_cylinder_unit tcu
WHERE tcu.region_code like concat('%', #{regionCode}, '%')
</select>
<insert id="saveOrUpdateBatch" parameterType="com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit">
INSERT INTO "amos_tzs_biz"."tz_cylinder_unit"(sequence_nbr,unit_id,region_code,unit_name,credit_code,address,unit_person,person_mobile_phone,person_telephone,postal_code,rec_date,rec_user_id,sync_date,sync_state,app_id,security_adm,security_adm_phone,region_name)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.sequenceNbr},
#{item.unitId},
#{item.regionCode},
#{item.unitName},
#{item.creditCode},
#{item.address},
#{item.unitPerson},
#{item.personMobilePhone},
#{item.personTelephone},
#{item.postalCode},
#{item.recDate},
#{item.recUserId},
#{item.syncDate},
#{item.syncState},
#{item.appId}),
#{item.securityAdm},
#{item.securityAdmPhone},
#{item.regionName}
</foreach>
on conflict (app_id) do update set
"unit_id" = EXCLUDED."unit_id",
"region_code" = EXCLUDED."region_code",
"unit_name" = EXCLUDED."unit_name",
"credit_code" = EXCLUDED."credit_code",
"address" = EXCLUDED."address",
"unit_person" = EXCLUDED."unit_person",
"person_mobile_phone" = EXCLUDED."person_mobile_phone",
"person_telephone" = EXCLUDED."person_telephone",
"postal_code" = EXCLUDED."postal_code",
"rec_date" = EXCLUDED."rec_date",
"rec_user_id" = EXCLUDED."rec_user_id",
"sync_date" = EXCLUDED."sync_date",
"sync_state" = EXCLUDED."sync_state",
"app_id" = EXCLUDED."app_id",
"security_adm" = EXCLUDED."security_adm",
"security_adm_phone" = EXCLUDED."security_adm_phone",
"region_name" = EXCLUDED."region_name"
</insert>
</mapper>
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